Number Base Converter — Binary ↔ Decimal ↔ Hex ↔ Octal
Type a value, choose whether it is decimal, binary, octal or hexadecimal, and see it in all the other bases at once. Click any result to copy it.
Why bases matter to developers
Computers store everything in binary, but binary is unreadable at length, so engineers use hexadecimal (base 16) as shorthand: one hex digit is exactly four bits, so 0xFF is 1111 1111 and a byte is always two hex digits. Octal (base 8) survives mainly in Unix file permissions (chmod 755). You meet hex constantly: colors (#58a6ff), memory addresses, MAC addresses, hashes, Unicode code points (U+1F600), bit masks and network packet dumps.
Converting by hand
Binary → hex: group bits in fours from the right and translate each group. Hex → decimal: multiply each digit by 16 raised to its position and add (0x2A = 2×16 + 10 = 42). Decimal → binary: repeatedly divide by 2 and read the remainders bottom-up. Knowing the method helps you sanity-check results. The tool uses ordinary JavaScript numbers, so integers are exact only up to 253 (9,007,199,254,740,992); beyond that, check the result with a language that has big integers.
Negative numbers
Hardware represents negative integers in two's complement: invert the bits and add one. The same bit pattern 0xFFFFFFFF is 4 294 967 295 as an unsigned 32-bit value and −1 as a signed one. This tool does not offer bit widths or two's complement: a negative value such as -255 is simply shown with a minus sign (-11111111 in binary). To get a two's-complement pattern, work it out by hand with the method above, or in a language where you can pick the integer width.
How to use it
- Enter a number and select its base (Decimal, Binary, Octal or Hex) in the Input Base list.
- Read the binary, octal, decimal, hex and 0x-prefixed hex results shown as cards.
- Click a card to copy that value.
One value, four bases
The decimal number 2026, with Input Base set to Decimal:
Binary 11111101010 Octal 3752 Decimal 2026 Hex 7EA Hex with prefix 0x7EA
Group the binary into fours from the right — 111 1110 1010 — and each group reads 7, E, A: the hex value.
Common use cases
- Reading register values, flags and bit masks in embedded or systems code.
- Translating Unix permission bits (
rwxr-xr-x→755) and umasks. - Decoding hex dumps, MAC addresses and IPv6 segments.
- Checking how many bits a value needs, by looking at the length of its binary form.
Tool behaviour and limits
The converter takes a value plus an input base (decimal, binary, octal or hexadecimal) and shows the binary, octal, decimal, hex and 0x-prefixed hex forms. It uses standard JavaScript number parsing, so integers above 253 (9,007,199,254,740,992) lose precision, and a negative value such as -255 is shown with a minus sign (-11111111) rather than as two’s complement. Input that is not valid in the chosen base, such as 2 in binary, is reported as invalid. For wide fields or signed encodings, check the result with a language that has big integers.
Quick checks
755 octal is 493 decimal, 111101101 binary: the permission bits rwxr-xr-x. And 255 decimal is FF hex and 377 octal.
Frequently asked questions
Does it support numbers larger than 2^53?
Not exactly. The tool uses plain JavaScript numbers, so integers above 9,007,199,254,740,992 lose precision. Use a big-integer tool for 64-bit and larger values.
How do I convert a negative number to hex?
The tool shows a minus sign followed by the hex of the absolute value (−255 gives -FF). It does not produce two's-complement patterns such as 0xFFFFFF01; compute those by hand or in code.
Can I convert fractional numbers?
No, only whole numbers: anything after a decimal point is ignored. Fractional binary and hex (used in floating-point formats) are a separate topic.
Which bases are supported?
Input can be decimal, binary, octal or hexadecimal, and the output shows all four. Other bases such as base 36 are not offered.
Why is a very large number slightly wrong?
Values beyond 9,007,199,254,740,992 exceed what JavaScript numbers can represent exactly, so use a big-integer tool for those.