Skip to content
MoneyDeck

Number Base Converter

Convert between binary, octal, decimal, hex and any base from 2 to 36

Updated · Free, no signup

Prefixes 0x, 0b, 0o and separators (spaces, _ ,) are allowed.

Converted number

11111111

Decimal (10)

255

Binary (2)

11111111

Octal (8)

377

Hexadecimal (16)

FF

Two’s complement (binary)

11111111

Bits needed

8

Bits in the magnitude, ignoring sign.

  • 255 in decimal = 11111111 in binary.
  • Read as a 8-bit signed integer, this bit pattern would mean -1.

About the Number Base Converter

This number base converter translates whole numbers between any two bases from 2 to 36 — binary to decimal, decimal to binary, hex to decimal, octal to hex and every other combination. Type the number, choose the base it is written in and the base you want, and you also get the binary, octal, decimal and hexadecimal forms side by side.

It uses arbitrary-precision integers, so 64-bit values, cryptographic constants and numbers hundreds of digits long convert exactly with no rounding. Common prefixes such as 0x, 0b and 0o are accepted, and spaces, commas or underscores used as digit separators are ignored. For negative numbers the tool also shows the two’s complement bit pattern at 8, 16, 32 or 64 bits, the way a CPU would store it.

It is handy for programmers reading memory dumps and bit masks, students learning positional notation in computer science or digital electronics, and anyone decoding a hex color or permission value. Only integers are supported; fractional parts are rejected rather than silently truncated.

How to use the number base converter

  1. 1Type the number you want to convert.
  2. 2Choose the base it is written in (for example Hexadecimal for FF).
  3. 3Choose the base you want to convert to.
  4. 4Read the converted value, plus the binary, octal, decimal and hex forms.
  5. 5For negative numbers, pick a bit width to see the two’s complement pattern.

Formula and method

N = Σ dᵢ × bⁱ (i = 0 for the rightmost digit)

In positional notation each digit is multiplied by the base raised to the power of its position, counting from 0 at the right. For example 1011 in binary is 1×8 + 0×4 + 1×2 + 1×1 = 11. The converter reads your digits this way to get the exact integer value, then writes it in the target base by repeatedly dividing by that base and collecting the remainders from last to first.

Digits above 9 use letters: A = 10, B = 11 … Z = 35, which is why base 36 is the maximum. Two’s complement represents a negative number −x in w bits as 2ʷ − x, so −1 in 8 bits is 11111111. Arbitrary-precision (BigInt) arithmetic keeps every digit exact.

N
The value of the number
dᵢ
Digit at position i (0–35)
b
The base (radix), 2–36

Worked examples

Decimal 255 to binary

255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1, so every one of the 8 bits is set: 11111111. In hexadecimal that is FF and in octal 377.

Hex DEADBEEF to decimal

0xDEADBEEF is the famous debugging marker. Each hex digit is 4 bits, so its 8 digits need 32 bits, and its decimal value is 3,735,928,559 — just below the 32-bit unsigned maximum of 4,294,967,295.

Negative number in two’s complement

42 is 101010 in binary (6 bits). As an 8-bit signed integer, −42 is stored as 256 − 42 = 214, which is 11010110 — the bit pattern you would see in memory.

Base 36 short code to decimal

In base 36, Z means 35, so ZZ = 35 × 36 + 35 = 1,295. Base 36 uses all digits and letters, which is why it is popular for short IDs and URL shorteners.

Frequently asked questions

How do I convert binary to decimal?+

Multiply each bit by its place value (1, 2, 4, 8, 16… from the right) and add the results. For 1101: 8 + 4 + 0 + 1 = 13. The converter does this exactly for numbers of any length.

How do I convert decimal to hexadecimal?+

Divide by 16 repeatedly and write down the remainders, using A–F for 10–15, then read them from last to first. 255 ÷ 16 = 15 remainder 15, giving FF.

What is two’s complement?+

It is how computers store signed integers. In w bits, a negative number −x is stored as 2ʷ − x, so the top bit acts as the sign. It lets the same adder circuit handle positive and negative numbers.

Why does hex use letters?+

Base 16 needs sixteen single-character digits, but 0–9 only provides ten, so A–F stand for 10–15. Each hex digit represents exactly 4 bits, making hex a compact way to write binary.

Can it convert very large numbers?+

Yes. It uses arbitrary-precision integers (BigInt), so values far beyond 64 bits convert exactly. Inputs are limited to 2,000 digits to keep the page responsive.

Related tools