Number Base Converter

Convert whole numbers between binary, octal, decimal and hexadecimal, any size.

Prefixes 0x, 0b and 0o override the base. Any size.
Hexadecimal
FF
0xFF
Decimal
255
Binary
1111 1111
0b11111111
Octal
377
0o377
Bits
8
1 byte

Number bases

  • Binary (base 2): digits 0 and 1 — how computers store everything.
  • Octal (base 8): 0–7. Mostly seen today in Unix file permissions like 755.
  • Decimal (base 10): everyday numbers.
  • Hexadecimal (base 16): 0–9 then A–F. Used for bytes, memory addresses and colors.

Prefixes

Code marks the base with a prefix: 0x for hex, 0b for binary and 0o for octal. Paste a prefixed number and the converter uses that base automatically. Underscores and spaces between digit groups are ignored.

Common questions

How do I convert hex to decimal?

Multiply each digit by 16 raised to its position, counting from 0 on the right. 0xFF = 15 × 16 + 15 = 255.

How do I convert decimal to binary?

Divide by 2 repeatedly and read the remainders from last to first. 13 → 6 r1 → 3 r0 → 1 r1 → 0 r1, so 1101.

Why is hex used for bytes?

One hex digit is exactly four bits, so a byte is always two hex digits (00–FF). That makes memory dumps, colors and hashes compact and easy to read.

How large a number can I convert?

Any size — the converter uses arbitrary-precision integers, so 64-bit values and beyond convert exactly.

MathApps is free and ad-free for now. If it helped, buy us some art supplies — supporters never see ads, even if we add them.