DevLab
123
Numbers⭐ Popularbeginner

Number Base Converter

convert numbers between binary, octal, decimal, and hex

By Bikram NathLast updated

Paste any integer in binary, octal, decimal, or hex and instantly see all four representations side by side. Useful when reading ARM disassembly where operands are hex but your bitmask logic is in binary: entering 0xFF immediately shows 11111111, 377, and 255 at once. Showing all four bases simultaneously without switching modes is what separates this from single-direction converters.

Try it now — free, instant, no signup

What is Number Base Converter?

Number Base Converter accepts an integer in any of the four common positional notation systems — base 2, 8, 10, or 16 — and displays the equivalent value in all four bases at the same time. Type 255 in the decimal field and 0xFF, 0377, and 11111111 appear immediately, letting you cross-reference without a second lookup.

Most developers reach for this instead of manually running parseInt() and toString() in a browser console, or opening RapidTables for a one-off conversion. It is faster than Python's bin()/oct()/hex() trio when you need all four results and don't have a terminal open, and it avoids the mental overhead of remembering that Python's oct() prefixes 0o while C traditionally uses 0.

One practical gotcha: the tool converts integers only. Floating-point values in other bases — such as IEEE 754 binary fractions — are out of scope, and entering a decimal point will produce unexpected results or an error. JavaScript's parseInt() underlying most browser-based converters also silently drops the fractional part rather than warning you, so if you type 10.5 expecting base-2 output for 10.5₁₀, you will get the conversion of 10 instead.

When to use Number Base Converter

Verify a subnet mask like 255.255.255.0 maps to the correct binary pattern before configuring a firewall rule.
Decode a packed flags byte from a hardware register datasheet where values are listed in hex but your code tests individual bits.
Cross-check that a hex color value such as #1A from a CSS file matches the decimal 26 your canvas drawing API expects.

Frequently Asked Questions

Why does entering a large hex value like 0xFFFFFFFF give a negative decimal on some converters but a positive one here?
The difference is signed versus unsigned interpretation. 0xFFFFFFFF is 4294967295 as an unsigned 32-bit integer, but JavaScript's bitwise operators coerce numbers to signed 32-bit integers internally, making it appear as -1 when you use operations like `>>> 0` in the console. A converter that pipes your input through bitwise ops will show -1; one that uses `parseInt('FFFFFFFF', 16)` directly preserves the unsigned value 4294967295. Always check which interpretation a tool uses when you are working with 32-bit hardware registers or IPv4 addresses.
What is the largest integer this will convert accurately?
JavaScript's Number type uses IEEE 754 double-precision floating-point, which represents integers exactly only up to 2^53 - 1, or 9007199254740991 (Number.MAX_SAFE_INTEGER). Beyond that threshold, integer precision is lost and conversions will silently round. If you need to convert 64-bit integers — common when working with database row IDs, cryptographic keys, or 64-bit register values — you would need a tool backed by BigInt arithmetic. For those cases, a Python one-liner using bin()/hex() on an actual int is more reliable than any browser-based converter that has not explicitly opted into BigInt.
Does the converter handle the 0x, 0b, or 0o prefix notation, or do I strip those manually?
Most browser-based converters using parseInt() will accept 0x prefixes for hex input because parseInt('0xFF', 16) and parseInt('FF', 16) both return 255. The 0b binary prefix is also handled by parseInt() in all evergreen browsers since it became part of ES2015. The octal 0o prefix is similarly safe. However, the old C-style octal notation using a leading zero — like 0377 — is ambiguous: parseInt('0377') returns 255 in some engines and 377 in others depending on whether strict mode is active. If you are entering an octal value, prefer the explicit 0o prefix or use the dedicated octal field rather than relying on prefix detection.
How do I convert a two's complement negative binary number to its decimal equivalent?
Two's complement is a specific interpretation of a fixed-width bit pattern, not an inherent property of the number itself. A converter showing all four bases works with the mathematical value of the input, so entering the binary string 11111111 returns 255 in decimal — the unsigned interpretation of eight bits. To get -1 (the 8-bit two's complement reading), you need to know the word width first, invert all bits, add one, and negate. No general-purpose base converter handles this automatically without knowing your target word size. For two's complement work, a dedicated signed-integer tool or a quick Python expression like `-(~0xFF & 0xFF) - 1` is more appropriate.
Can I use this to convert hex color codes like #3A7BD5 to RGB decimal values?
Partially. You can paste 3A into the hex field to get decimal 58, then repeat for 7B (123) and D5 (213), giving you rgb(58, 123, 213). That works fine for individual channel inspection. However, if you want to convert a full six-digit hex color string to an rgb() triplet in one step, the Color Converter tool on this site handles that directly — it splits the three channel bytes and formats the output as CSS rgb() automatically. Use this tool when you want to understand what a single hex byte means numerically; use Color Converter when you want a ready-to-paste CSS value.

Related Tools