Number Base Converter
Type a number in binary, octal, decimal, hex or a custom base and see it in all the others at once, with exact results for numbers of any size.
🔒 Runs entirely in your browser. Nothing you enter is sent to a server.
The same quantity can be written in many ways. Two hundred and fifty-five is 255 in decimal, 11111111 in binary, 377 in octal and ff in hexadecimal. This converter translates between all of them at once, plus any custom base from 2 to 36, and it stays exact for numbers far beyond what a calculator can hold.
How to use the number base converter
- Type a number into any of the boxes: binary, octal, decimal, hexadecimal or the custom base.
- All the other boxes update as you type.
- Change the custom base to anything from 2 to 36. Base 36 uses the digits 0–9 and the letters a–z.
- Tick Uppercase hex or Group binary digits if you prefer that layout.
Invalid digits, such as a 2 in a binary number, are flagged straight away, and the status line shows how many bits the number needs.
How positional number systems work
In any base b, each digit is worth the digit value times b raised to the power of its position, counting from 0 on the right:
value = dₙ × bⁿ + … + d₂ × b² + d₁ × b¹ + d₀ × b⁰
Digits above 9 use letters: a = 10, b = 11 and so on up to z = 35.
To go the other way, from decimal to base b, divide by b again and again and collect the remainders. Read them from last to first.
Worked example: 2026 to binary
Divide by 2 until you reach 0, noting each remainder:
| Number | ÷ 2 | Remainder |
|---|---|---|
| 2026 | 1013 | 0 |
| 1013 | 506 | 1 |
| 506 | 253 | 0 |
| 253 | 126 | 1 |
| 126 | 63 | 0 |
| 63 | 31 | 1 |
| 31 | 15 | 1 |
| 15 | 7 | 1 |
| 7 | 3 | 1 |
| 3 | 1 | 1 |
| 1 | 0 | 1 |
Reading the remainders from the bottom up gives 11111101010.
The same number is 3752 in octal and 7EA in hex. Check the hex: 7 × 256 + 14 × 16 + 10 = 1,792 + 224 + 10 = 2,026.
The shortcut between binary, octal and hex
Because 8 = 2³ and 16 = 2⁴, you can convert without going through decimal:
- Binary to hex: group the bits in fours from the right, and convert each group.
111 1110 1010→7 E A. - Binary to octal: group the bits in threes.
11 111 101 010→3 7 5 2.
Where each base is used
| Base | Name | Typical use |
|---|---|---|
| 2 | Binary | How computers store everything, bit flags, network masks |
| 8 | Octal | Unix file permissions such as chmod 755 |
| 10 | Decimal | Everyday numbers |
| 16 | Hexadecimal | Colours like #C0FFEE, memory addresses, byte values, hashes |
| 36 | Base 36 | Short IDs and URL shorteners, using all digits and letters |
The colour #C0FFEE is, in decimal, the number 12,648,430.
Tips and pitfalls
- Leading zeros do not change the value.
0011and11are the same binary number, but zeros are often added to show a fixed width such as 8 bits. - Watch for precision loss in code. In JavaScript,
parseIntand normal numbers stop being exact above 2⁵³. UseBigIntfor IDs and large values. - Letters are case-insensitive.
FF,ffandFfall mean 255. - Octal literals can surprise you. In some languages, a leading zero such as
010means octal 8, not decimal 10. - Fractions are not supported here. This converter handles whole numbers. Fractions such as 0.1 often have no exact binary form, which is why 0.1 + 0.2 is not exactly 0.3 in most programming languages.
Frequently asked questions
How do I convert binary to decimal?
Multiply each binary digit by 2 raised to the power of its position, counting from 0 on the right, and add the results. For 1011 that is 8 + 0 + 2 + 1 = 11. Or type it into the binary box above.
Why do programmers use hexadecimal?
One hex digit represents exactly four binary digits, so a byte is always two hex digits. That makes hex a compact, readable way to write binary data such as colours, memory addresses and hashes.
Can I use prefixes like 0x and 0b?
Yes. You can type 0x before a hexadecimal number, 0b before a binary number and 0o before an octal number. Spaces and underscores used to group digits are ignored too.
How large a number can I convert?
As large as you like. The converter uses arbitrary-precision integers, so a 200-digit number converts exactly. Many tools lose precision above 9,007,199,254,740,991, the largest whole number JavaScript can store exactly in an ordinary number.
How are negative numbers shown?
With a minus sign in every base, for example −101 in binary for −5. Computers usually store negative numbers in two's complement, which depends on the number of bits, so this tool does not convert to that form.