Skip to main content
Online
Computer science · step-by-step

Number Base Converter

Convert a whole number between any two bases from 2 to 36. The solver expands the digits by place value, then divides repeatedly to build the result, so you can see exactly how it works.

Digits beyond 9 use letters: A = 10, B = 11 … Z = 35. Prefixes 0x, 0b and 0o are understood.

Complete guide

Number base conversion: binary, octal, decimal, hexadecimal and any base up to 36

3 min read Reviewed By the GetCalcMaster team · Editorial policy

A number base (radix) is the number of distinct digits a positional system uses. Decimal uses ten digits (0–9), binary uses two (0, 1), octal eight, and hexadecimal sixteen (0–9 then A–F). The same quantity can be written in any base; only the representation changes. Converting between bases uses two simple procedures: expanding by place value to reach decimal, and repeated division to leave it.

The converter handles whole numbers in any base from 2 to 36 using exact big-integer arithmetic and shows both procedures, plus the bit-grouping shortcut between binary, octal and hex.

Key formulas

To decimal (place value)
(dₖ…d₁d₀)_b = dₖ·bᵏ + … + d₁·b + d₀
0x7E8 = 7·256 + 14·16 + 8 = 2024.
From decimal (repeated division)
divide by the target base, record the remainder, repeat with the quotient
Read the remainders from last to first.
Binary grouping
hex digit = 4 bits · octal digit = 3 bits
1111 1111₂ = FF₁₆; 111 101 101₂ = 755₈.
Number of digits
⌊log_b(n)⌋ + 1
An n-bit number needs about n/4 hex digits.

Worked examples

Example 1: 2024 to hexadecimal

Convert 2024₁₀ to base 16.

  1. 2024 ÷ 16 = 126 remainder 8.
  2. 126 ÷ 16 = 7 remainder 14 (E).
  3. 7 ÷ 16 = 0 remainder 7.
  4. Read upward: 7E8.
Answer: 2024₁₀ = 7E8₁₆.
Example 2: Binary to decimal

Convert 11010110₂.

  1. 128 + 64 + 0 + 16 + 0 + 4 + 2 + 0.
  2. = 214.
Answer: 214.
Example 3: Octal to binary

Convert 755₈ (a Unix permission) to binary.

  1. Each octal digit becomes 3 bits: 7 → 111, 5 → 101, 5 → 101.
Answer: 111101101₂ — rwx r-x r-x.
Example 4: Base 36

Write 1295 in base 36.

  1. 1295 ÷ 36 = 35 remainder 35 (Z).
  2. 35 ÷ 36 = 0 remainder 35 (Z).
Answer: ZZ₃₆ — the largest two-digit base-36 number.

Where each base is used

Base Name Typical use
2 Binary Bits, flags, digital logic
8 Octal Unix file permissions
10 Decimal Everyday arithmetic
16 Hexadecimal Memory addresses, colors (#FF8800), byte dumps
36 Base-36 Short IDs and URL shorteners (0–9 and A–Z)

Bits, bytes and two's complement

Computers store whole numbers in fixed-width groups of bits: 8 bits make a byte, which holds 2⁸ = 256 different values (0 to 255, or 00 to FF in hexadecimal). That is why one hex digit corresponds to exactly four bits and two hex digits describe one byte.

Negative integers are usually stored in two's complement. To write −5 in 8 bits, take 5 = 00000101, invert every bit to get 11111010, then add 1: 11111011 (FB in hex). The same bit pattern read as an unsigned number is 251, so always check whether a value is meant to be signed. This converter works with the mathematical value and a minus sign; the Programmer calculator shows fixed-width two's complement views.

Common mistakes to avoid

  • Reading the remainders top-down instead of bottom-up.
  • Using a digit that does not exist in the base (like 8 in octal).
  • Confusing the letter O with zero or I with one in high bases.
  • Forgetting the place value of zero digits when expanding.

Frequently asked questions

Why do programmers use hexadecimal?
One hex digit is exactly four bits, so a byte is always two hex digits. It is far more compact than binary but maps onto it directly.
Does the converter handle negative numbers?
Yes, as a sign plus magnitude. For two's complement bit patterns use the programmer calculator.
Can I convert fractional numbers?
This tool converts whole numbers. Fractional parts are converted by repeated multiplication by the base, which can produce infinitely repeating digits.
How many digits will the result have?
A positive whole number N needs ⌊log_b N⌋ + 1 digits in base b. For example, 1000 needs 10 binary digits because 2⁹ = 512 ≤ 1000 < 1024 = 2¹⁰, but only 3 hexadecimal digits (3E8).

Related tools and guides

Educational content. Results are computed in your browser with standard double-precision arithmetic; double-check anything with legal, financial, medical, or safety consequences. Spotted an error? Tell us and we will correct it.