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
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
- (2×16^1 + 10×16^0) = 42₁₀Read 2a as base-16 positional notation
- 42₁₀ = 42(base 10)Write 42₁₀ in base 10
Maintained by Jack Shi
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.
Verified runs
Synthetic examples executed at build revision be2e0e4 on . Cards round decimal results to 6 significant figures; matching uses full precision and the tolerance below. Matches cover the displayed fields, not every possible input or clinical or engineering validation.
Inputs: Value: 255 integer in fromBase; Source base: 10 radix; Target base: 16 radix
Result: Converted value: FF target-base integer (expected Converted value: FF target-base integer) ✓
Inputs: Value: 0 integer in fromBase; Source base: 10 radix; Target base: 2 radix
Result: Converted value: 0 target-base integer (expected Converted value: 0 target-base integer) ✓
Inputs: Value: 1010 integer in fromBase; Source base: 2 radix; Target base: 10 radix
Result: Converted value: 10 target-base integer (expected Converted value: 10 target-base integer) ✓
How these runs were checked
Method: base-converter@1.0.0. Expectations come from the listed test fixtures or hand arithmetic; they are not copied from these executions. Omitted optional inputs use the method defaults. Run dates record execution, not expert review or fresh measurements.
Download all verified runs (JSON) — full inputs, returned values, expectations, timestamps and buildRevision.
- normal: . Absolute tolerance: 1e-10. Text and booleans match exactly. Full-precision result: Converted value: FF target-base integer. Expected: Converted value: FF target-base integer. Expectation: packages/calculator-core/src/calculators/base-converter.test.ts
- boundary: . Absolute tolerance: 1e-10. Text and booleans match exactly. Full-precision result: Converted value: 0 target-base integer. Expected: Converted value: 0 target-base integer. Expectation: packages/calculator-core/src/calculators/base-converter.test.ts
- sensitivity: . Absolute tolerance: 1e-10. Text and booleans match exactly. Full-precision result: Converted value: 10 target-base integer. Expected: Converted value: 10 target-base integer. Expectation: packages/calculator-core/src/calculators/base-converter.test.ts
Reproduce from the source checkout with pnpm --filter @sumivo/web gen:verified-runs. A rebuild changes execution times; the revision identifies its Git starting point, including any uncommitted changes made for that build.
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
- OpenStax, Rice UniversityContemporary Mathematics — 4.3 Converting with Base Systems ↗
Positional numeral systems and converting a whole number between bases 2–36
Accessed 2026-09-22