Number base converter

Convert a whole number between binary, octal, decimal, hexadecimal and any base from 2 to 36.

How it works

The digits are read from left to right: value = value × base + digit. To write the value in another base it is divided by that base repeatedly; the remainders, read backwards, are the digits.

Worked example

  1. 255 ÷ 16 = 15 remainder 15 (F)
  2. 15 ÷ 16 = 0 remainder 15 (F)
  3. 255 = 0xFF = 0b11111111

Frequently asked questions

How do I read a hexadecimal number?

Each digit is worth 16 times the one to its right, with A–F standing for 10–15. 0x2F = 2 × 16 + 15 = 47.

Can I type 0x, 0b or 0o?

Yes. A 0x, 0b or 0o prefix picks hexadecimal, binary or octal automatically; spaces and underscores between digits are ignored.

How large can the number be?

Practically any size: whole numbers are handled with BigInt, so a 100-digit number converts exactly. Fractions and negative numbers in other bases are not supported.