Number Base Converter

Convert binary, octal, decimal and hexadecimal side by side, or switch to any base from 2 to 36. Very large and negative numbers are converted exactly.

Any base (2 to 36)

Digits above 9 are written A=10, B=11 … Z=35. Upper and lower case are treated the same.

Bits
—
Bytes
—
Two’s complement
—
iPhone app · Free to downloadQR Code Reader · Barcode ScansScan any QR code or barcode instantly and keep a history of codes you create.View on the App Store

About the Number Base Converter

Type a number into any field and all the others update instantly. The converter shows the bases you need most in programming, computer science and electronics – binary (BIN), octal (OCT), decimal (DEC) and hexadecimal (HEX) – and the lower box lets you pick any base from 2 to 36.

It uses exact arbitrary-precision integers (BigInt), so numbers like 2⁶⁴ convert without rounding errors, and negative numbers also show their two’s complement representation.

How to use

  1. Type a number into the field for the base you know. The other fields update automatically.
  2. Prefixes 0x (hex), 0b (binary) and 0o (octal) are accepted; spaces and _ separators are ignored.
  3. For other bases, choose 2–36 under Any base and type the value there.
  4. Use the Copy button next to each field to copy the result.

Worked examples

The largest 32-bit signed integer

Input
0x7FFFFFFF in the hex field
Result
Decimal 2147483647, binary in groups of 4 0111 1111 1111 1111 1111 1111 1111 1111, 31 bits, 4 bytes

The 0x prefix is accepted and ignored. This is the value at which a signed 32-bit counter overflows; adding 1 in a program would wrap around to −2,147,483,648.

Reading chmod 644

Input
644 in the octal field
Result
Decimal 420, binary 110100100, hex 1A4

Each octal digit is three bits: 6 = 110 (rw-), 4 = 100 (r--), 4 = 100 (r--). So the owner can read and write, and everyone else can only read.

Short IDs in base 36

Input
1000000 in the decimal field, base 36 selected under Any base
Result
Base 36 LFLS, hex F4240

Base 36 uses 0–9 and A–Z, so one million fits in four characters. That is why some URL shorteners and order numbers use it.

How base conversion works

Decimal → base N: divide by N repeatedly and read the remainders from bottom to top. Example: 13 → 13÷2 = 6 r 1, 6÷2 = 3 r 0, 3÷2 = 1 r 1, 1÷2 = 0 r 1 → 1101₂

Base N → decimal: multiply each digit by the matching power of N and add them up. Example: 1A₁₆ = 1×16 + 10×1 = 26

Binary ↔ hex: group binary digits in fours from the right; each group is one hex digit (groups of three for octal). 1101 0111₂ = D7₁₆

Common values

DecimalBinaryOctalHex
81000108
10101012A
15111117F
16100002010
100110010014464
25511111111377FF
1024100000000002000400
655351111111111111111177777FFFF

Negative numbers and two’s complement

The converter writes negative numbers with a minus sign, as in math: −1010₂. Computers usually store negatives in two’s complement, where −x in n bits is 2ⁿ − x. Example: −10 in 8 bits = 256 − 10 = 246 = 1111 0110₂ (0xF6). The info box shows the two’s complement in the smallest width that fits (8, 16, 32, 64 or 128 bits).

FAQ

Can it convert very large numbers?

Yes. It uses integers without a digit limit, so numbers with dozens of digits convert exactly. Numbers with a fractional part are not supported.

Can I type lowercase hex?

Yes. Input is case-insensitive; results are shown in uppercase (A–F).

Why does it stop at base 36?

The ten digits 0–9 plus the 26 letters A–Z give 36 symbols. Base 36 is sometimes used for short IDs and URL shorteners.

Is 0xFF the same as FF?

Yes. 0x only marks a number as hexadecimal, so you can type it with or without the prefix in the hex field; the same goes for 0b in the binary field and 0o in the octal field. In the decimal field, 0x is reported as an invalid digit.

What do the bits and bytes figures mean?

Bits is the minimum number of binary digits needed for the value (without the sign), and bytes rounds that up to whole 8-bit bytes. For example, 420 needs 9 bits, so it doesn't fit in one byte (maximum 255) and needs 2. For color values such as #FF8800, the color converter also shows RGB and HSL.