Skip to content
K Knidox Search…
Reference · Notation

Number Base Converter

Convert between binary, octal, decimal, and hexadecimal.

From base
Examples — tap to load
Decimal (base 10)
255

Converted across all common bases below.

BaseValue
Binary11111111
Octal377
Decimal255
HexadecimalFF

To convert a number between bases, divide it repeatedly by the target base and read the remainders from bottom to top. Binary is base 2, octal base 8, decimal base 10, and hexadecimal base 16. For example, decimal 156 is 10011100 in binary, 234 in octal, and 9C in hex.

How positional bases work

In any base, each digit position is worth the base raised to a power, counting from zero on the right. We count in base 10, so 372 means 3×10² + 7×10¹ + 2×10⁰. Binary (base 2) works the same way with powers of two, octal with powers of eight, and hexadecimal with powers of sixteen — the only difference is the base you raise.

The four bases at a glance

Same value, four notations.

DecimalBinaryOctalHex
0000
81000108
10101012A
15111117F
16100002010
25511111111377FF

Worked example: decimal 156 to binary

The repeated-division method divides by the target base and records the remainders, then reads them bottom to top.

  1. 1
    Divide by 2, note the remainder. 156 ÷ 2 = 78 r0, 78 ÷ 2 = 39 r0, 39 ÷ 2 = 19 r1, 19 ÷ 2 = 9 r1.
  2. 2
    Keep going until the quotient is 0. 9 ÷ 2 = 4 r1, 4 ÷ 2 = 2 r0, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1.
  3. 3
    Read the remainders bottom to top. 10011100 — so 156 in decimal is 10011100 in binary.
  4. 4
    Check by place value. 128 + 16 + 8 + 4 = 156. Confirmed.

Reading hexadecimal

Hex uses the digits 0–9 then A–F for ten through fifteen. One hex digit maps to exactly four binary bits (a nibble), so any byte fits in two hex digits — which is why colors (#FF8800), memory addresses, and byte dumps are written in hex. For older notations, the Roman numeral converter handles the pre-positional system, and the scientific notation converter covers very large decimal values.

One hex digit = four bits

Group binary in fours from the right, then translate each group.

BinaryHexDecimal
000000
010155
100199
1100C12
1111F15
What is the largest number I can convert?
Up to the safe integer limit (2⁵³ − 1, about 9 quadrillion). Beyond that, floating-point precision can no longer guarantee an exact result.
Does it handle decimals or fractions?
This tool converts whole numbers. Converting the fractional part of a number between bases is a separate, repeated-multiplication procedure.
Why is hex used in computing?
Each hex digit maps to exactly four bits, so a byte is two hex digits. That makes long binary strings far shorter and easier to read without losing the bit pattern.
What is the difference between octal and hex?
Octal groups bits in threes (base 8); hex groups them in fours (base 16). Hex aligns neatly with 8-bit bytes, which is why it is far more common today.
How do I convert binary straight to hex without going through decimal?
Split the binary into groups of four bits from the right, then replace each group with its hex digit — for example 1011 0110 becomes B6.
Why do programmers count from zero?
The rightmost digit position is base⁰ = 1, and exponents start at zero. Counting positions from zero keeps the place-value math consistent.