Number Base Converter
Convert a number between decimal, binary, octal and hex. Any base from 2 to 36, Roman numerals and English words too, with fractions converted exactly and the working shown.
How to Use
- Type a number. Prefixes are understood:
0xfor hex,0bfor binary,0ofor octal; Roman numerals and number words are recognised too. - If the number could be read more than one way (101 is decimal unless you say otherwise), choose what it is under Input is.
- Set Base N to also see the number in any base from 2 to 36, or to read the input in that base.
- Read decimal, binary, octal and hex in the readouts, and every other form in the table. Click any value to copy it.
- Open Show Work for the place values, the repeated division and the bit grouping.
Worked Example
42 to binary, octal and hex. Divide by 2 and keep the remainders: 42 ÷ 2 = 21 r 0, 21 ÷ 2 = 10 r 1, 10 ÷ 2 = 5 r 0, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Reading upwards, 42 = 101010₂. Group the bits by four from the right, 0010 1010, and each group becomes one hex digit: 2A₁₆. By three, 101 010, for octal: 52₈. Check: 2 × 16 + 10 = 42.
10.625 to binary. The whole part, 10, is 1010. For the fraction, multiply by 2 and take off the whole number each time: 0.625 × 2 = 1.25 (digit 1), 0.25 × 2 = 0.5 (digit 0), 0.5 × 2 = 1.0 (digit 1), and it ends. So 10.625 = 1010.101₂: 8 + 2 + ½ + ⅛.
The common mistake: reading the remainders downwards. Taking them in the order they come gives 010101, which is 21, not 42. The first remainder is the ones digit, so it goes on the right. And not every fraction ends: 0.1 in binary is 0.0001100110011…, repeating for ever, which is why computers cannot store it exactly.
Show Work
Formulas
Why Different Bases
Our decimal system, with ten digits and a zero that holds an empty place, came from India and was described by Brahmagupta in 628; it reached Europe through Arabic scholars and Fibonacci’s Liber Abaci of 1202. Base 10 is an accident of our ten fingers: the Babylonians counted in 60s, the Maya in 20s, and the same idea of place value works in any base.
Gottfried Leibniz published binary arithmetic in 1703, but it became essential only with electronic computers, whose circuits have two states. Binary numbers are long, so programmers write them in octal, which suited early machines with 12-, 18- and 36-bit words, or in hexadecimal, which IBM’s System/360 made standard in 1964 when 8-bit bytes became the norm: one byte is exactly two hex digits.
About This Calculator
This converter reads a number in decimal, binary, octal, hex, any base from 2 to 36, Roman numerals or English words, and shows it in all of them at once, with scientific notation and the two’s-complement bit pattern. It works with whole numbers of any length and with fractions, exactly: it uses whole-number arithmetic throughout, so 2⁶⁴ − 1 is not rounded and a repeating fraction is marked with a line over the digits that repeat.
Everything runs in your browser; nothing is sent anywhere. Show Work sets out the place values, the repeated division and the grouping into hex and octal, so it doubles as a way to check homework.
Related calculators: Arbitrary Base Converter, Base Arithmetic Calculator, and Two’s Complement Converter.
Frequently Asked Questions
How do I convert decimal to binary?
Divide by 2 and write down the remainder, then divide the answer by 2 again, until you reach 0. The remainders read from the last to the first are the binary digits. 42 gives remainders 0, 1, 0, 1, 0, 1, so 42 is 101010 in binary.
How do I convert binary to hex or octal?
Group the bits from the right: four at a time for hex, three for octal, and replace each group with one digit. 101010 is 0010 1010 = 2A in hex, and 101 010 = 52 in octal. That is why programmers use hex: each hex digit is exactly four bits.
Why does 0.1 never end in binary?
A fraction ends in a base only if its denominator divides a power of that base. 0.1 is 1/10, and 10 has a factor of 5, which no power of 2 contains, so in binary it repeats for ever: 0.0001100110011… That is why 0.1 + 0.2 is not exactly 0.3 in most programming languages.
What bases can I use?
Any base from 2 to 36. Digits above 9 are written with letters, A = 10 up to Z = 35, so base 36 uses all of 0–9 and A–Z. Bases above 36 need more symbols; see the arbitrary base converter for those.
What range do Roman numerals and number words cover?
Standard Roman numerals run from I to MMMCMXCIX (1 to 3,999); there is no zero, and larger numbers used a bar over a numeral to multiply it by 1,000. Number words here go up to 10³⁶ − 1, the decillions on the short scale used in English.
How do I use the Number Base Converter?
Simply type or paste your value and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Does it cost anything or need an account?
No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.
Is anything I type uploaded?
No. The tool works entirely on your device, so the values you enter never leave your browser.
Common Use Cases
Programming
0xFF8800 is 16,746,496; the largest 32-bit unsigned value, 4,294,967,295, is FFFFFFFF.
Unix permissions
chmod 755 is octal: 111 101 101 in binary, 493 in decimal.
Learning
10.625 is 1010.101 in binary, with each place value drawn out.
Roman numerals
2026 is MMXXVI and 1984 is MCMLXXXIV.
Big numbers
2⁶⁴ − 1 is 18,446,744,073,709,551,615, exactly, with no rounding.
Last updated: