Number Base Converter
Convert integers between binary, octal, decimal and hexadecimal with live, error-checked fields.
Type a whole number in any field and instantly see it in binary, octal, decimal and hexadecimal — all in your browser. Free. No sign-up. Runs in your browser, nothing is uploaded.
Enter a number in any base
Type in any field and the other three update live. Whole, non-negative integers only — clear a field to reset all four.
Type a number into any of the four fields — binary, octal, decimal or hexadecimal — and the other three show the same value instantly. Each field has its own copy button, and a character that doesn't belong to that base (a 2 in binary, a G in hex) is flagged instead of producing a wrong answer. Pasted values can include a 0x, 0b or 0o prefix and digit groups separated by spaces or underscores.
Converting by hand: 156 in all four bases
Knowing the method makes the converter's output easier to sanity-check.
Decimal → binary: divide by 2 and collect remainders. 156 ÷ 2 = 78 r 0, 78 ÷ 2 = 39 r 0, 39 ÷ 2 = 19 r 1, 19 ÷ 2 = 9 r 1, 9 ÷ 2 = 4 r 1, 4 ÷ 2 = 2 r 0, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Read the remainders bottom-up: 10011100.
Binary → hex: split into groups of four from the right. 1001 1100 → 9 and C → 9C.
Binary → octal: split into groups of three from the right. 10 011 100 → 2, 3, 4 → 234.
Back to decimal to check: 9 × 16 + 12 = 156, and 2 × 64 + 3 × 8 + 4 = 156. The grouping trick works because 16 = 2⁴ and 8 = 2³, which is exactly why programmers use hex and octal as shorthand for binary.
The sixteen nibbles
A nibble is four bits — one hex digit. Learn these and you can read any hex value as binary on sight:
| Hex | Binary | Dec | Hex | Binary | Dec | |
|---|---|---|---|---|---|---|
| 0 | 0000 | 0 | 8 | 1000 | 8 | |
| 1 | 0001 | 1 | 9 | 1001 | 9 | |
| 2 | 0010 | 2 | A | 1010 | 10 | |
| 3 | 0011 | 3 | B | 1011 | 11 | |
| 4 | 0100 | 4 | C | 1100 | 12 | |
| 5 | 0101 | 5 | D | 1101 | 13 | |
| 6 | 0110 | 6 | E | 1110 | 14 | |
| 7 | 0111 | 7 | F | 1111 | 15 |
Landmark values worth recognising
| Decimal | Hex | Octal | What it is |
|---|---|---|---|
| 255 | FF | 377 | Largest value in one byte |
| 256 | 100 | 400 | Number of values in a byte |
| 1,024 | 400 | 2000 | 2¹⁰ — one kibibyte |
| 65,535 | FFFF | 177777 | Largest 16-bit unsigned value; highest port number |
| 4,294,967,295 | FFFFFFFF | 37777777777 | Largest 32-bit unsigned value |
When a bug report contains a suspicious number like 65,535 or 4,294,967,295, it usually means a counter overflowed or a −1 was stored in an unsigned field.
Where you'll actually meet these bases
- Unix file permissions are octal. Each digit is three bits: read (4), write (2), execute (1).
chmod 755is111 101 101= rwxr-xr-x;644is110 100 100= rw-r--r--. In decimal, 755 octal is 493 — which is why typing the decimal form into code gives nonsense. - Web colours are three hex bytes.
#FF8800splits into FF, 88, 00 = red 255, green 136, blue 0. - Bit flags read best in binary. A settings value of 0x2C is
101100: bits 2, 3 and 5 are on, counting from 0 on the right. - Memory addresses, hashes and byte dumps are hex because two hex digits describe one byte exactly.
Pitfalls that catch people out
- A leading zero can mean octal. In C, and in older JavaScript,
0755in source code is an octal literal, so010equals 8. Python 3 rejects that form and requires0o755. - Big numbers lose precision elsewhere. JavaScript numbers, and most spreadsheets, are only exact up to 9,007,199,254,740,991 (2⁵³ − 1). Above that, 9,007,199,254,740,993 quietly becomes …992. This converter uses arbitrary-precision integers, so it stays exact at any length.
- Spreadsheet functions have small ranges. Excel's
DEC2BIN, for example, only accepts −512 to 511. - Hex case doesn't matter.
ff,FFandFfare the same value; the output is upper-cased for readability.
For measurements rather than number systems, the unit converter works the same way, and the color converter handles hex colour codes specifically.
Frequently asked questions
Related tools
All Converters tools →- Unit ConverterConvert length, weight, temperature and data units instantly — right in your browser.
- Roman Numeral ConverterConvert numbers to Roman numerals and Roman numerals back to numbers, with standard subtractive notation and a breakdown of how each numeral is built.
- CM to Inches ConverterConvert centimeters to inches (and back) instantly — with common values, the exact formula and a reference table.
