Skip to main content

Number Base Converter

Convert numbers between decimal, binary, hexadecimal, and octal. Edit any field to update the rest live.

Decimal base 10

Base 10 — digits 0–9

Binary base 2
0b

Base 2 — digits 0–1

Hexadecimal base 16
0x

Base 16 — digits 0–9, A–F

Octal base 8
0o

Base 8 — digits 0–7

Bit length 8
Decimal value 255
Hex (prefixed) 0xFF
Binary (prefixed) 0b11111111

How to Convert Decimal, Binary, Hex, and Octal

This number base converter translates unsigned integers between decimal, binary, hexadecimal, and octal as you type. It uses BigInt, so values larger than JavaScript’s Number.MAX_SAFE_INTEGER (2^53 − 1) keep their precision.

Invalid digits for the active base are flagged instead of silently rounding. Pair it with the color converter when you are working with hex colors rather than integer hex.

Tips

  • Binary uses 0 and 1 only; octal 0–7; hex 0–9 and A–F.
  • Copy the prefixed form (0x, 0b, 0o) when pasting into source code.
  • Negative numbers and fractions are not converted — this tool is for unsigned integers.

More from Shane Code