Number base converter with steps
Type a number, pick the base it is in and the base you want. The converter is exact even for huge numbers, spots repeating fractions and shows every step: repeated division, place values and the multiplication method.
How it is calculated
How positional number systems work
In base b every digit is worth digit × bposition. In decimal, 255 means 2 × 10² + 5 × 10¹ + 5 × 10⁰. Binary uses only 0 and 1, octal 0–7 and hexadecimal 0–9 plus A–F (A = 10 … F = 15). Bases above 10 borrow letters, up to Z = 35 in base 36.
How to convert number bases
- Type the number, including digits after the point or a minus sign.
- Choose “From base” and “To base” (binary, octal, decimal, hexadecimal), optionally the max. digits after the point and two’s complement from 8 to 64 bits.
- Read the result in all four bases and the step-by-step working.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 100 | 110 0100 | 144 | 64 |
| 255 | 1111 1111 | 377 | FF |
Any base to decimal: add up place values
Multiply each digit by its power of the base and add: FF₁₆ = 15 × 16¹ + 15 × 16⁰ = 240 + 15 = 255. Digits after the point get negative powers: 0.1₂ = 1 × 2⁻¹ = 0.5.
Decimal to any base: repeated division
Divide by the target base again and again, writing down the remainders until you reach 0. Reading the remainders from bottom to top gives the answer. Example, 13 to binary:
- 13 ÷ 2 = 6 remainder 1
- 6 ÷ 2 = 3 remainder 0
- 3 ÷ 2 = 1 remainder 1
- 1 ÷ 2 = 0 remainder 1
Bottom to top: 13 = 1101₂.
Fractions: the multiplication method and repeating digits
Multiply the fractional part by the base; the whole-number part is the next digit, then carry on with what is left. 0.1 to binary: 0.1 × 2 = 0.2 → 0; 0.4 → 0; 0.8 → 0; 1.6 → 1; 1.2 → 1; then 0.4 comes back. Result: 0.1 = 0.0(0011)₂, a repeating fraction – which is why computers cannot store 0.1 exactly.
Whether an expansion terminates depends only on the reduced denominator: it terminates exactly when every prime factor of the denominator also divides the base. 1/2 terminates in binary (0.1₂); 1/10 does not, because 5 does not divide 2. The converter finds the period exactly, since it works with whole numbers (BigInt) rather than floating point.
Negative numbers and two’s complement
On paper a negative number just gets a minus sign: −255 = −FF₁₆. Processors store it in two’s complement: write the magnitude in binary, flip every bit, add 1. −1 in 8 bits: 0000 0001 → 1111 1110 → 1111 1111. With n bits the range is −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1, so 8 bits hold −128 to 127 and 128 overflows.
Other number formats: the Roman numeral converter, powers of two in the exponent calculator and huge values with the scientific notation converter.
Frequently asked questions
How do I convert decimal to binary?
Keep dividing by 2 and note each remainder until the quotient is 0. The remainders read from bottom to top are the binary number: 13 → 6 r1, 3 r0, 1 r1, 0 r1 → 1101.
How do I convert hex to decimal?
Multiply each digit by 16 to the power of its position (counting from 0 on the right) and add. A–F stand for 10–15: 2F₁₆ = 2 × 16 + 15 = 47.
Why does one hex digit match four binary digits?
Because 16 = 2⁴. Split a binary number into groups of four from the right and translate each group: 1111 1111 = F F = FF. Octal works the same way with groups of three, since 8 = 2³.
Why is 0.1 a repeating fraction in binary?
0.1 = 1/10, and 10 has the prime factor 5, which base 2 lacks. Such fractions never terminate in binary: 0.1 = 0.000110011…₂. That is why 0.1 + 0.2 is not exactly 0.3 in most programming languages.
What is two’s complement?
The standard way computers store negative integers: write the magnitude in binary, invert all bits and add 1. −1 in 8 bits becomes 1111 1111 (FF). An 8-bit value ranges from −128 to 127.
Which bases are supported?
Any base from 2 to 36. Beyond that we run out of symbols: 0–9 and A–Z make 36. Letters are not case-sensitive.
Sources and legal basis
- Wikipedia: Positional notation (base conversion, terminating fractions)
- Wikipedia: Two’s complement
- MDN Web Docs: parseInt() – radix 2 to 36, digits 0–9 and A–Z
As of:
Related tools
- Exponent calculator with stepsCalculate powers, nth roots and logarithms with any base – step-by-step, with negative and fractional exponents, ln, log and scientific notation.
- Scientific Notation Converter with StepsConvert numbers to and from scientific notation: a × 10ⁿ, E notation, engineering notation with SI prefixes and standard form – exact, step by step.
- Roman Numeral ConverterConvert Roman numerals to numbers and back (1–3,999) with step-by-step working, the subtractive rule and checks for wrong forms like IIII or IC.
- Fraction CalculatorAdd, subtract, multiply and divide fractions and mixed numbers with step-by-step solutions. Simplify fractions and convert decimals to fractions.
- Significant Figures CalculatorCount significant figures, round to n sig figs and apply the rules for multiplying and adding – with highlighted digits, full working and scientific notation.
- Times tables practicePractise times tables online: pick the tables, answer on a big number pad, take a quiz with results or look up the chart. Mistakes come back more often. Free.