Number Base Converter

Convert integers between binary, octal, decimal and hexadecimal with live, error-checked fields.

Runs in your browserUpdated Built and maintained by Leon and Henrik

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.

Number Base Converter

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.

Runs in your browser
Nothing is uploaded

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:

HexBinaryDecHexBinaryDec
000000810008
100011910019
200102A101010
300113B101111
401004C110012
501015D110113
601106E111014
701117F111115

Landmark values worth recognising

DecimalHexOctalWhat it is
255FF377Largest value in one byte
256100400Number of values in a byte
1,02440020002¹⁰ — one kibibyte
65,535FFFF177777Largest 16-bit unsigned value; highest port number
4,294,967,295FFFFFFFF37777777777Largest 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 755 is 111 101 101 = rwxr-xr-x; 644 is 110 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. #FF8800 splits 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, 0755 in source code is an octal literal, so 010 equals 8. Python 3 rejects that form and requires 0o755.
  • 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, FF and Ff are 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