Binary, Octal, Decimal and Hex Converter
Type into any of the four fields and the other three update as you go.
For bases outside binary, octal, decimal and hex, use the any-base converter instead.
Type in any field and the others update instantly. Positive integers of any length, so a full 64-bit value converts exactly. A bad digit is reported rather than silently ignored.
This page shows binary, octal, decimal and hexadecimal side by side and keeps all four in step as you type into any one of them. For base 3, base 12, base 36 or anything else outside those four, and for the division-and-remainder working written out, use the any base 2 to 36 converter.
Number base conversion changes how a number is represented.
Base systems:
- Binary (base 2): Uses digits 0 and 1
- Octal (base 8): Uses digits 0 to 7
- Decimal (base 10): Uses digits 0 to 9 (everyday numbers)
- Hexadecimal (base 16): Uses digits 0 to 9 and letters A to F
Examples:
- Decimal 255 = Binary 11111111 = Octal 377 = Hex FF
- Decimal 42 = Binary 101010 = Octal 52 = Hex 2A
- Decimal 10 = Binary 1010 = Octal 12 = Hex A
Common uses:
- Binary: computer memory, digital circuits
- Octal: Unix file permissions
- Hexadecimal: colors (#FF0000), memory addresses
These bases all exist for a reason rooted in how computers work. Binary is the machine’s native language because a transistor is either on or off, one or zero, with nothing between. The trouble is that binary gets unwieldy fast: a single byte is eight digits, like 11111111. Hexadecimal fixes that by packing exactly four binary digits into one hex digit, so that byte becomes a tidy FF.
That four-to-one mapping is why hex turns up wherever programmers need to read binary at a glance. A web color like #FF0000 is three bytes, one each for red, green, and blue: FF means full red, 00 means none of the others, so the result is pure red. Octal works the same way with three bits per digit, which is why Unix file permissions, like 755, are written in it.
Reading a Unix permission by eye. Each octal digit is three bits, and the three bits are read, write, execute in that order. So 7 is 111, all three; 5 is 101, read and execute but not write; 4 is 100, read only; 6 is 110, read and write. The three digits are owner, group, everyone else. That makes 755 the classic rwxr-xr-x: the owner can do anything, everyone else can read and run it but not change it. 644 is rw-r--r--, the normal file. 600 is rw-------, which is what an SSH private key must be or the client refuses to use it.
Powers of two worth knowing on sight. 2^8 is 256, one byte, and FF in hex. 2^10 is 1,024, the kilo that is not a thousand. 2^16 is 65,536, which is why old game scores capped at 65,535 and why a TCP port number stops there. 2^31 - 1 is 2,147,483,647, the largest signed 32-bit integer, which is the number behind the 2038 problem and behind more than one overflow bug in software that counted seconds. 2^32 is about 4.3 billion, which is every IPv4 address there will ever be.
Bit width is the thing the number itself does not tell you. The value 255 fits in 8 bits; 256 does not. That single bit is the difference between a byte that works and one that wraps to zero, and it is why so many limits in software are one less than a round binary number. When a field is described as 16-bit unsigned, the range is 0 to 65,535; signed, it is -32,768 to 32,767, because one bit goes to the sign and the negative side gets the extra slot.
Watch out for leading zeros in code. In C, Java and older JavaScript, a numeric literal beginning with 0 is read as octal, so 010 is 8, not 10. It has caused real bugs in date handling, where somebody wrote 08 for August and the compiler rejected it as an invalid octal digit. Modern languages mostly use an explicit 0o prefix, and 0x for hex, precisely to stop this.
How we build and check this converter
This converter runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.
SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.