Guide
Converting between binary, octal, decimal and hex
The same number can be written in many ways. 255 in decimal is 11111111 in binary, 377 in octal and FF in hexadecimal. Programmers, students and electronics hobbyists switch between these constantly. This converter shows a number in all the common bases at once, for integers of any size.
Using the converter
Type a number into any field (binary, octal, decimal, hexadecimal or the custom base) and every other field updates. A few conveniences:
- Prefixes like 0x, 0b and 0o, spaces and underscores are ignored, so you can paste
0xFF_FFor1111 0000directly. - Group digits shows binary and hex in blocks of four and decimal with commas, which makes long values readable. The copy buttons always copy the plain value.
- For numbers up to 64 bits, the line at the bottom shows how many bits and bytes the value needs.
Digits that aren’t valid for the base, such as a 2 in binary or a G in hex, trigger a warning rather than a wrong answer.
How number bases work
In base 10 each position is worth ten times the one to its right: 1, 10, 100… In base 2 it’s 1, 2, 4, 8, 16; in base 16 it’s 1, 16, 256, 4096. Bases above ten need extra digits, so hexadecimal uses A–F for 10 to 15, and base 36 uses the whole alphabet.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
| 1024 | 10000000000 | 2000 | 400 |
Converting by hand
To decimal: multiply each digit by its position value and add. Hex 2F = 2×16 + 15 = 47.
From decimal: divide by the base repeatedly and read the remainders upward. 47 ÷ 2 gives remainders 1, 1, 1, 1, 0, 1, so 47 = 101111.
Binary ↔ hex shortcut: every hex digit is exactly four bits. Split binary into groups of four from the right and translate each group: 1010 1111 = AF. Octal works the same way with groups of three.
Where each base shows up
- Hex colors: #FF8800 is three bytes: red 255, green 136, blue 0. The Color Converter goes further.
- File permissions: Unix chmod 755 is octal: 111 101 101 in binary, meaning rwx for the owner and r-x for others.
- Bit flags and masks: binary shows exactly which flags are set; 0b1010 has bits 1 and 3 on.
- Memory addresses, hashes and IDs: almost always hex.
- Short codes: base 36 packs large numbers into short strings of digits and letters.
Big numbers and limits
Values are calculated with arbitrary-precision integers, so a 40-digit decimal number converts exactly, without the rounding a normal calculator shows past about 16 digits. Negative numbers keep their minus sign.
Two things aren’t supported: fractions (such as 0.1 in binary) and two’s-complement representations, where −1 in an 8-bit byte is 11111111. Programming references or a calculator in programmer mode cover those.
Who converts number bases
- Computer science students practice binary, octal and hex conversions.
- Developers read memory addresses, bit flags, color values and permission codes.
- Network engineers work with IP address masks and MAC addresses.
- Electronics hobbyists read register values and microcontroller data.
A complete example: a subnet mask
A network uses the mask 255.255.255.192. Convert 192 to binary: 11000000. The two 1s plus the 24 ones in 255.255.255 make a /26 network, with 6 host bits, meaning 64 addresses per subnet.
Tips
- Turn on digit grouping to read long binary numbers in blocks of four.
- Copy buttons copy the plain value, without the grouping spaces.
Related tools
- Text to Binary to see the bytes behind text.
- Color Converter for hex, RGB and HSL colors.
- Roman Numeral Converter for a very different number system.
- Scientific Calculator for arithmetic on the results.
Checked against the current version of the Number Base Converter on .

