Sumivo · Mathematics

Base Converter

Convert a whole number between any bases from 2 to 36 — binary, octal, decimal, hexadecimal and beyond — with the value shown in every common base. Exact arithmetic on whole numbers.

01 / inputs

base 16
base
base

02 / result

VALUE IN BASE 10

42

Decimal (base 10)
42
Binary (base 2)
101010
Octal (base 8)
52
Hexadecimal (base 16)
2A
Digits in base 10
2

Calculation trace

  1. (2×16^1 + 10×16^0) = 42₁₀
    Read 2a as base-16 positional notation
  2. 42₁₀ = 42(base 10)
    Write 42₁₀ in base 10
§

How it works

A number written in base b means each digit is a power of b: for example 2A in base 16 is 2×16 + 10×1 = 42 in base 10 (the digit A stands for 10). The tool reads your value that way to get an exact base-10 value, then rewrites it in the target base by repeated division — dividing by the base and reading the remainders from last to first. Digits above 9 use the letters A–Z, so the highest single digit in base 36 is Z (35). Everything runs on exact big integers, so the result stays precise no matter how large the number is, unlike ordinary floating-point which loses precision past 2^53.

Assumptions & limits

  • Whole numbers only; a decimal point or fraction is not converted.
  • Both bases must be integers from 2 to 36, the range that fits the digits 0–9 and letters A–Z.
  • Input is case-insensitive; an optional 0x, 0b or 0o prefix and leading zeros are ignored, and a leading minus sign is kept.
  • A digit that is not valid for the source base — such as 2 in base 2, or G in base 16 — is rejected rather than guessed.
§

FAQ

What bases can I convert between?
Any whole-number base from 2 to 36, in either direction. Base 2 is binary, base 8 octal, base 10 decimal and base 16 hexadecimal; bases up to 36 use the letters A–Z for the digits above 9.
How do I write hexadecimal or higher bases?
Use 0–9 then A–Z for the extra digits. In base 16, A=10 through F=15 (so FF = 255). In base 36, the digits run 0–9 then A=10 up to Z=35.
Why does 2A in base 16 equal 42?
Because each place is a power of 16: 2A means 2×16 + 10×1, and A stands for 10, giving 32 + 10 = 42 in base 10.
Does it handle very large numbers exactly?
Yes. The conversion uses big-integer arithmetic, so values well beyond 2^53 stay exact — for example FFFFFFFFFFFFFFFF in base 16 is 18446744073709551615 in base 10.
Can it convert fractions or negative numbers?
A leading minus sign is supported, but fractional values are not converted — this tool works on whole numbers only.
§

Related calculators

§

SOURCES