Number Base Converter (Binary, Octal, Hex)
Convert between bases 2 to 36: binary, octal, decimal, hexadecimal. Fractional numbers, repeating expansions, division and multiplication steps, two's complement.
What is a number base?
In the decimal system we use every day each position stands for a power of 10: 419 = 4 · 100 + 1 · 10 + 9. Other bases follow the same rule with powers of the base. Computers work in binary (base 2), and programmers often write hexadecimal (base 16) or octal (base 8). This tool converts between any two bases from 2 to 36 and shows the working step by step.
Converting to decimal
Multiply each digit by its place value and add the results. For hexadecimal 1A3: 1 · 16² + 10 · 16 + 3 = 256 + 160 + 3 = 419. In hexadecimal A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.
Converting from decimal to another base
Divide the whole part by the base again and again and note the remainders. Turning 13 into binary: 13 ÷ 2 = 6 remainder 1, 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1. Read the remainders from last to first: 1101. Multiply the fractional part by the base again and again and take the whole part of each product as the next digit: 0.625 is 0.101 in binary.
Repeating fractions
A fraction that ends in decimal may go on forever in another base. In binary 0.1 continues as 0.000110011… The tool finds the repeating block and writes it in brackets: 0.0(0011). This is why 0.1 + 0.2 does not come out as exactly 0.3 on a computer.
The shortcut between binary, octal and hex
Because 8 = 2³ and 16 = 2⁴, binary digits convert directly in groups of three or four: binary 1101 0011 is hexadecimal D3.
Two's complement and limits
Computers store negative whole numbers in two's complement. For −5 in 8 bits write 5 (00000101), flip the bits (11111010) and add 1 (11111011). The tool gives this form for 8, 16, 32 and 64 bits. The floating point format (IEEE 754) is not covered.
Related calculators
-
Mathematics
Roman Numeral Converter
Converts numbers from 1 to 3999 to Roman numerals and Roman numerals back to numbers. Shows the breakdown and flags invalid forms such as IIII or VX. -
Mathematics
Prime Number and Prime Factorization Calculator
Is the number prime, its prime factors, its divisors, the previous and next prime. All primes in a range with the sieve of Eratosthenes. Exact up to 2⁶⁴, with steps. -
Mathematics
Scientific Calculator
Type an expression and see the result at once: trigonometry, logarithms, powers, roots, factorials. Degree and radian modes, memory and history, all in your browser. -
General Calculations and Unit Conversion
Unit Converter (Engineering Units)
Convert length, pressure, temperature, power, energy, flow, torque and more than 50 quantities. Type a value and see it in every unit in one table.
Found a mistake or something missing?
If a value looks wrong, a size is missing or you need a feature, write to us and we will fix it.