/tools/number-base-converter

Number Base Converter

Convert integers between any two bases from 2 to 36. Large values are handled with arbitrary precision, so nothing is silently rounded.

Number Base ConverterRuns in your browser
 
Common bases

Sets the target base.

—
—

Common bases

How to use the Number Base Converter

  1. Type the number. Prefixes like 0x and 0b are accepted and stripped automatically.
  2. Set the base it is currently in and the base you want.
  3. The result appears immediately, with the common bases listed underneath.

Why computing uses base 2, 8 and 16

Hardware is binary: every value is ultimately a pattern of ones and zeros. But binary is unreadable at any length — one byte takes eight characters, and a 32-bit address takes thirty-two.

Hexadecimal solves this because 16 is 2⁴, so each hex digit maps to exactly four bits with no arithmetic required. FF is 11111111; A is 1010. That clean correspondence is why memory addresses, colour codes and byte dumps are all written in hex. Octal (base 8, three bits per digit) served the same purpose on older machines and survives mainly in Unix file permissions.

Reading the digits above 9

Bases beyond 10 need extra symbols, and the convention is to continue with letters: A = 10, B = 11, through Z = 35. That upper limit is why base 36 is the maximum here — it uses every digit and every letter exactly once.

Base 36 has a practical use: it produces the shortest identifiers that survive being typed, spoken or put in a URL without special characters. A number that takes 12 decimal digits fits in 8 base-36 characters.

Exact conversion of large numbers

Converting via a standard floating-point number breaks silently above 2⁵³ − 1. A 64-bit hash or a long identifier converted that way comes back subtly wrong, with no error to warn you.

This tool uses arbitrary-precision integers instead, so a 256-bit hexadecimal value converts to decimal exactly. The trade-off is that fractional values are not supported — base conversion of fractions produces infinitely repeating expansions in most base pairs, so a general-purpose result would have to be rounded anyway.

Frequently asked questions

Why does hex use letters?

Base 16 needs sixteen distinct digit symbols, and only ten exist. A through F fill the gap, representing 10 to 15.

Can it convert decimals or fractions?

No, whole numbers only. Fractions rarely terminate when converted between bases — 0.1 in decimal is infinitely repeating in binary, which is the root of most floating-point surprises.

How large a number can it handle?

There is no practical limit. Arbitrary-precision arithmetic means a 512-bit value converts exactly, with no rounding or loss.

What do the 0x and 0b prefixes mean?

They are programming conventions marking hexadecimal and binary literals. They are notation rather than part of the number, so they are stripped automatically.

Related tools