← All tools/Converters/Number/Number Base Converter
Number Base Converter
One number, in binary, octal, decimal and hexadecimal.
Converted value
All bases at a glance
How it works
Repeated division by the new base gives the digits in reverse; digits above 9 use A–F (A = 10, …, F = 15).
The method is repeated division. To convert a decimal number to another base, divide it by the new base and write down the remainder; divide the quotient again, and keep going until the quotient is zero. The remainders, read from last to first, are the digits of the answer. Digits above 9 need letters, so base 16 uses A for 10 through F for 15. Each position in any base is worth the base raised to a power — in binary, the places are worth 1, 2, 4, 8 and so on from the right. It applies to whole numbers in bases 2, 8, 10 and 16. It does not handle fractions or negative numbers, and every digit you type must belong to the base you picked.
Worked example: decimal 255 is binary 11111111, octal 377 and hexadecimal FF.
Second worked example: decimal 2,026 — the year of India’s independence was 1947, but take 2,026 itself. In binary it is 11111101010, because 2,026 = 1,024 + 512 + 256 + 128 + 64 + 32 + 8 + 2. In octal, dividing by 8 gives remainders 2, 5, 7, 3, read backwards as 3752. In hexadecimal, 2,026 ÷ 16 = 126 remainder 10 (A), 126 ÷ 16 = 7 remainder 14 (E), leaving 7 — so the answer is 7EA.
Common mistakes
The commonest mistake is typing a digit the base does not allow — an 8 or 9 in octal, or a G in hexadecimal — which is not a number at all in that base, so the converter stops and asks you to check the digits. A second mistake is reading binary backwards: the leftmost digit is the biggest place value, so 101 is five, not one. People also mix up 0 and the letter O when copying hexadecimal by hand — always use the digit zero. Leading zeros change nothing (011 is still 3 in binary), so do not add them expecting a different answer. If a conversion looks wrong, convert the answer back to decimal and check it matches what you started with.
Frequently asked questions
Why do computers use binary?
Hardware has two states — on and off — so binary, base 2, maps directly onto circuits, with 1 meaning current flowing and 0 meaning no current. Every number, letter and picture inside a computer is stored as a string of these two states. Other bases exist only as shorthand for humans, because long strings of ones and zeros are hard to read.
What are octal and hexadecimal for?
They are shorthand for binary: one octal digit stands for 3 bits, and one hexadecimal digit stands for 4 bits. Programmers use hexadecimal to write memory addresses, colour codes such as #673DE6, and byte values, because two hex digits describe exactly one byte. Octal survives mainly in file permissions on Linux systems, where each digit sets read, write and execute rights.
Why do letters appear in hexadecimal?
Base 16 needs sixteen digits, so after 0–9 it uses A–F for the values 10–15. The letters are just digits with a different shape — A behaves exactly like the digit 10 would, so F in the ones place means fifteen and 1F means one sixteen plus fifteen, which is thirty-one in decimal.
Can I convert a number with a decimal point?
No — this converter handles whole numbers only, so a decimal point or a fraction is rejected. To convert a fractional part by hand, multiply the fraction by the new base repeatedly and read off the whole-number parts. For everyday use, convert the whole-number part here and work out the fraction separately, keeping the two parts clearly apart.
What is the biggest number I can convert?
Very large numbers can lose accuracy, because the converter stores the value as a JavaScript number, which is exact only up to about 9,007,199,254,740,992. Below that, every whole number converts exactly. If you are converting long binary strings from hardware registers or cryptographic values, split them into smaller chunks and convert each chunk on its own.
More tools
Tell us what you think
Loving this tool, or stuck on something? Tell us — it takes a minute.
We’ll only use your name and email to reply if needed. The tool and page are filled in for you.