Number Base Converter (Base 2 to 36)

Type a value, say what base it is written in, and choose the base you want it in. This converter handles every radix from 2 to 36, accepts a fractional part after the decimal point, and shows the work both ways: the positional expansion that turns your digits into a plain quantity, and the repeated division that turns that quantity into digits in the new base. Binary, octal and hexadecimal forms are always shown alongside, since those are the three you most often need next.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Value to convertDigits 0-9 then A-Z stand for 0-35. One decimal point is allowed; spaces, commas and underscores are ignored.255
Source base (radix)The base your value is currently written in: 2 for binary, 8 for octal, 10 for decimal, 16 for hex.10
Target base (radix)The base you want the answer in. Any whole number from 2 to 36.16
Fraction digits to showHow far to carry a fractional part that does not terminate in the target base.8

It returns

  • Value in the target base — Your value rewritten with the digits of the base you asked for.
  • Value in base 10 — The plain quantity the digits stand for, independent of any base.
  • Binary (base 2)
  • Octal (base 8)
  • Hexadecimal (base 16)
  • Digits in the result — Length of the whole-number part in the target base, ignoring any fraction.

The formula

n=kdkbk
digits=logbn+1

In plain text: n = Σ dₖ · b^k (positional value); digits of n in base b come from repeated division by b

  • nThe quantity the digit string stands for (number)
  • bThe base (radix), from 2 to 36 (integer)
  • dₖThe digit in position k, worth 0 to b−1 (integer)
  • kPosition index: 0 at the point and rising leftwards, negative to the right (integer)

Converting from base b uses the sum directly. Converting to base b runs it backwards: divide by b repeatedly and the remainders are the digits, produced least significant first.

Updated Category Number Theory, Divisors & Number Systems Verified against published test cases Reading time 13 min

What a base actually is

A base, or radix, is the number of distinct digits a numeral system uses and the factor by which each place is worth more than the one to its right. Decimal has ten digits, 0 through 9, and each column is ten times the last. Binary has two, 0 and 1, and each column doubles. Hexadecimal has sixteen, so it borrows A through F for the values ten to fifteen. Base 36 exhausts the Latin alphabet: Z stands for 35.

What does not change is the quantity. The string 255, the string FF and the string 11111111 all denote the same number of things; they are three spellings, not three values. This is the single idea that makes base conversion feel obvious once it lands: you are re-spelling a quantity, not transforming it. Nothing about the number itself is base-dependent — whether it is prime, whether it is even, what it is divisible by. A number that is a multiple of 3 stays a multiple of 3 in every base.

Positional notation says a digit's contribution is its face value times a power of the base. Reading 255 in base 10, the digits contribute 2×10² + 5×10¹ + 5×10⁰ = 200 + 50 + 5. Reading the same characters in base 16 gives 2×256 + 5×16 + 5 = 597, which is why you must always state the base a numeral is written in. The subscript notation 255₁₆ or the programming prefixes 0x, 0b and 0o exist for exactly this reason.

The rule extends past the point. Digits to the right of the radix point take negative powers: in binary, 0.11 means 1×2⁻¹ + 1×2⁻² = 0.5 + 0.25 = 0.75. Nothing about the method changes; only the exponent goes negative.

The two algorithms, and why they are opposites

Every conversion between arbitrary bases is done in two stages: read the source digits into a plain quantity, then write that quantity out in the target base. This calculator shows both stages, and each has its own method.

Reading in — the positional sum. Multiply each digit by its place value and add. In practice you do not need the powers at all: Horner's method walks the digits left to right, multiplying the running total by the base and adding the next digit. For 1234 in base 5 that is 1, then 1×5+2 = 7, then 7×5+3 = 38, then 38×5+4 = 194. Four multiplications, no exponents, and no intermediate value larger than the answer.

Writing out — repeated division. Divide the quantity by the target base. The remainder is the last digit, because it is precisely the part that does not reach one full unit of the next place up. Then divide the quotient again for the next digit, and keep going until the quotient is zero. The digits emerge least significant first, which is why you read them upwards from the bottom of the table. That single fact accounts for most hand-conversion errors.

The two stages are inverses, which is worth checking whenever you are unsure. Convert forward, convert back, and you must land on what you started with. The long division calculator shows any one of those division steps in full detail, and the quotient-and-remainder pair it produces is exactly what the digit extraction relies on.

Fractions run the other way round. Instead of dividing and keeping remainders, you multiply the fractional part by the target base and keep the whole part that pops out in front of the point. Multiply 0.6875 by 2 to get 1.375: the digit is 1 and 0.375 carries on. This produces digits most significant first, so you read downwards. The process may never terminate: one third is 0.333… in decimal and 0.0101… repeating in binary, and one tenth — exact in decimal — repeats forever in binary. A fraction terminates in base b exactly when its denominator, in lowest terms, has no prime factor outside the primes dividing b. That is why tenths repeat in binary but thirds do not repeat in base 12 or base 36.

Power-of-two bases get a shortcut. Because 16 = 2⁴, every hex digit maps to exactly four bits and no arithmetic is needed: F is 1111, 5 is 0101, so 0x5F is 01011111. Likewise one octal digit is three bits. Converting between binary, octal and hexadecimal is regrouping, not calculating, which is the whole reason those two bases became the standard shorthand for bit patterns.

Worked example: 1234₅ to base 7, and 0.6875 to binary

Stage 1 — read 1234 in base 5 as a quantity. The place values are 5³ = 125, 5² = 25, 5¹ = 5 and 5⁰ = 1.

  1. 1 × 125 = 125
  2. 2 × 25 = 50
  3. 3 × 5 = 15
  4. 4 × 1 = 4
  5. Total: 125 + 50 + 15 + 4 = 194.

Stage 2 — write 194 in base 7 by repeated division.

  1. 194 ÷ 7 = 27 remainder 5. Last digit: 5.
  2. 27 ÷ 7 = 3 remainder 6. Next digit: 6.
  3. 3 ÷ 7 = 0 remainder 3. Next digit: 3. The quotient is 0, so stop.
  4. Read the remainders upwards: 365₇.

Check it by expanding back: 3 × 49 + 6 × 7 + 5 = 147 + 42 + 5 = 194. ✓ Note that 365₇ and 365₁₀ share their digits and share nothing else — a good reminder that a numeral without a stated base is ambiguous.

A fraction: 0.6875 decimal into binary. Multiply by 2 and harvest the whole part each time.

  1. 0.6875 × 2 = 1.375 → digit 1, carry 0.375
  2. 0.375 × 2 = 0.75 → digit 0, carry 0.75
  3. 0.75 × 2 = 1.5 → digit 1, carry 0.5
  4. 0.5 × 2 = 1.0 → digit 1, carry 0. Terminated.
  5. Reading downwards: 0.6875 = 0.1011₂.

Verify: 1/2 + 0/4 + 1/8 + 1/16 = 0.5 + 0.125 + 0.0625 = 0.6875. ✓ It terminated because 0.6875 = 11/16 and 16 is a power of 2. Try 0.1 instead and the digits run 0.000110011001… forever, which is the origin of the classic floating-point surprise that 0.1 + 0.2 does not equal 0.3.

How to read the result

Digit count tells you how much room the number needs. Writing n in base b takes ⌊logb n⌋ + 1 digits, so a smaller base always needs more digits for the same quantity. 255 is three digits in decimal, two in hex and eight in binary. That trade — fewer symbols, longer strings — is the only thing you are choosing between when you pick a base.

A result that is all the maximum digit means you are at a boundary. FF in hex, 111111112 in binary and 377 in octal are all 255, one below 256 = 2⁸. Any base-b numeral consisting of k copies of the digit b−1 equals bk − 1, which is why 255, 65535 and 4294967295 keep appearing in computing: they are the largest values that fit in 8, 16 and 32 bits.

Trailing zeros carry information. A number ends in k zeros in base b exactly when it is divisible by bk. Binary numbers ending in three zeros are multiples of 8; decimal numbers ending in two zeros are multiples of 100. That is also the quickest divisibility test available in any base: look at the last digit to test divisibility by any factor of the base.

Watch the exact-integer ceiling. This converter is exact for whole numbers up to 2⁵³ ≈ 9.007 × 10¹⁵, the limit of exact integer arithmetic in a browser. Above that, low-order digits can be wrong, and the calculator says so. A 12-digit base-36 string already exceeds that ceiling, since 36¹² ≈ 4.7 × 10¹⁸, so split long identifiers into chunks before converting them.

Finally, the fractional part is computed in binary floating point, so a fraction that repeats in the target base is approximated. The whole-number part carries no such caveat.

Reference: the same values in five bases

Every row is one quantity written five ways. Read across to see how the digit count grows as the base shrinks.
DecimalBinary (2)Octal (8)Hex (16)Base 36
00000
5101555
810001088
10101012AA
15111117FF
16100002010G
351000114323Z
36100100442410
641000000100401S
19411000010302C25E
25511111111377FF73
1,29510100001111241750FZZ
4,0951111111111117777FFF36F

Check the last row: FFF = 15×256 + 15×16 + 15 = 4,095 = 2¹² − 1, and 3×1,296 + 6×36 + 15 = 3,888 + 216 − nothing left over = 4,095 in base 36.

Why 36 is the ceiling

The limit is not mathematical — bases run to infinity — but notational. Conventional digit strings use 0-9 followed by A-Z, which supplies exactly 36 symbols, and base 36 is therefore the largest radix that can be written with ordinary alphanumerics and read unambiguously. Beyond it you need a new convention: base 64 encoding, for example, adds two more characters and is a byte-packing scheme rather than a positional numeral system. At the other end, base 1 does not exist as positional notation: with a single digit symbol every place value would be 1k = 1, and the sum could never distinguish position.

Mistakes that produce the wrong conversion

  • Reading the remainders downwards. Repeated division yields the least significant digit first. The first remainder you compute is the last digit of the answer.
  • Using a digit the base does not have. There is no 8 in octal and no 2 in binary. A string like 129 is simply not an octal numeral, and this calculator rejects it rather than reinterpreting it.
  • Assuming a terminating decimal terminates in binary. 0.1 and 0.2 are exact in base 10 and repeat forever in base 2. That is why money is normally handled in integer cents rather than binary floating point.
  • Dividing by the source base instead of the target base. The repeated-division stage always divides by the base you are converting into.
  • Confusing a numeral with a value. 10 means two in binary, eight in octal, ten in decimal and sixteen in hex. Always carry the base with the numeral.
  • Expecting negative numbers as bit patterns. This tool writes a minus sign in front. Two's complement is a fixed-width representation, so −5 has no answer until you say whether the word is 8, 16 or 32 bits wide.
  • Converting values past 2⁵³ in one go. Long hex hashes and base-36 identifiers exceed exact integer range; convert them in chunks of a few digits.

Which base to use, and where each one comes from

Binary is the base of physical computing because a circuit reliably distinguishes two states, not ten. Everything above it is human convenience. Hexadecimal caught on because 16 = 2⁴ makes each digit exactly one nibble, so a byte is always two hex characters and no arithmetic is needed to move between the two — which is why memory addresses, colour codes and hash digests are written in hex. Octal held the same role on machines with 12-, 24- or 36-bit words, and survives in Unix file permissions, where three bits of read/write/execute map onto one octal digit.

Base 36 turns up wherever a number has to be squeezed into a short alphanumeric string: shortened URLs, invoice references, and licence keys. Base 12 has a mathematical argument behind it — 12 has four proper divisors against 10's two, so thirds and quarters terminate — and it survives in inches, hours and dozens. Base 60, inherited from Babylonian astronomy, is still how you read a clock and a compass.

Two neighbouring ideas are often confused with base conversion. Scientific notation rewrites a number as a mantissa times a power of ten; the base is unchanged, only the layout differs. And Base64 encoding, despite the name, packs three bytes into four characters rather than evaluating a positional sum — the Base64 size calculator covers what that does to a payload.

For the number-theoretic side of bases, the modulo calculator handles the remainder arithmetic that digit extraction depends on, and the prime factorization calculator tells you which fractions will terminate in a given base: the answer depends only on which primes divide the base. If you work with hex colour values, the hex to RGB converter applies the same base-16 reading to three channels at once.

Key terms

Base (radix)
The number of digit symbols a numeral system uses, and the ratio between adjacent place values. Base 16 uses sixteen symbols and each column is worth sixteen times the one to its right.
Positional notation
A writing system in which a digit's value depends on its position, as digit × base^position. Roman numerals are not positional; every system this calculator handles is.
Most / least significant digit
The leftmost digit contributes most to the value; the rightmost contributes least. Repeated division produces the least significant digit first.
Nibble
Four bits — exactly one hexadecimal digit. Two nibbles make a byte, so a byte is always two hex characters.
Two's complement
The standard fixed-width representation of signed integers in hardware, where the top bit carries negative weight. It requires a stated word size, so it is not a base conversion.
Terminating fraction
A fraction whose base-b expansion ends. In lowest terms it terminates exactly when the denominator's prime factors all divide b.

Frequently asked questions

How do I convert binary to decimal by hand?

Multiply each bit by its place value and add. For 11111111 the places are 128, 64, 32, 16, 8, 4, 2 and 1, and every bit is set, so the total is 255. A faster route is doubling: start at 0 and for each bit from the left, double the running total and add the bit. For 1011 that gives 1, 2, 5, 11. Both methods produce the same answer; the doubling method avoids writing out powers.

Why is hexadecimal used so much in computing?

Because 16 is a power of 2, so each hex digit stands for exactly four bits with no arithmetic. A byte is always two hex characters, a 32-bit address is always eight, and you can convert either way by table lookup. Decimal has no such alignment — 255 gives no hint that it is eight set bits, while FF makes it obvious. Octal serves the same purpose in groups of three bits, which is why Unix permissions are written as 755 or 644.

What is the largest base this calculator supports, and why 36?

Base 36, because 0-9 plus A-Z gives exactly 36 distinct digit symbols and no more are conventionally defined. Z is worth 35, the largest single digit. Higher bases are mathematically fine but need an agreed set of extra symbols, and schemes such as Base64 that go further are encodings rather than positional numeral systems.

Can I convert numbers with a decimal point?

Yes. Enter a value such as 3.75 and the fractional digits are converted by repeated multiplication by the target base. If the fraction does not terminate in that base the digits are cut off at the limit you set, and the calculator flags that it truncated rather than rounded. Raise the fraction-digits setting to see more places.

Why does 0.1 in decimal not convert exactly to binary?

Because 0.1 is 1/10 and 10 has a prime factor of 5, which does not divide 2. A fraction terminates in base b only when the denominator's prime factors all divide b, so tenths repeat forever in binary: 0.000110011001… That single fact explains why 0.1 + 0.2 comes out as 0.30000000000000004 in almost every programming language, and why financial code stores integer cents instead.

How many digits will my number need in the new base?

Take the base-b logarithm, round down, and add one: ⌊log_b n⌋ + 1. Going to a smaller base always lengthens the string. 255 needs three decimal digits, two hex digits and eight binary digits. As a rule of thumb, binary strings are about 3.3 times longer than the decimal ones, since log₂10 ≈ 3.32.

How do I convert between binary, octal and hex quickly?

Group the bits, do not calculate. One hex digit is four bits and one octal digit is three, so 11111111 splits as 1111 1111 = FF in hex, and as 011 111 111 = 377 in octal. Pad the leftmost group with zeros if it is short. This works only between bases that are powers of the same number; converting hex to base 7 needs the full two-stage method.

Does changing base change whether a number is prime or even?

No. Base affects only how a quantity is written, never the quantity itself. 255 is composite whether you write it as FF, 377 or 11111111. What does change is which properties are easy to see: an even number ends in 0 in binary and in 0, 2, 4, 6 or 8 in decimal, and a multiple of 16 ends in 0 in hex. Divisibility by any factor of the base is always visible in the last digit.

How do I write a negative number in another base?

This calculator carries a minus sign through and converts the magnitude, which is called signed-magnitude notation. Computers normally use two's complement instead, where −5 in an 8-bit register is 11111011. That representation depends entirely on the word width — the same value is 1111111111111011 in 16 bits — so it cannot be produced from a base and a value alone.

References