Binary, Decimal and Hex Converter
One number, all four bases, worked out exactly however long it gets. Nothing is uploaded.
How to use it
- Say which base the number you have is written in.
- Type it. Spaces are ignored, and a leading
0b,0oor0xis accepted and stripped. - All four bases update together. The grouped binary on the left shows it padded into whole bytes.
Reading binary without a converter
Write the place values from the right — 1, 2, 4, 8, 16, 32,
64, 128 — and add the ones sitting under a 1. So
1011 is 8 + 0 + 2 + 1 = 11, and 11111111 is
255, which is why a byte stops there.
Going the other way, keep halving and write down the remainders, then read them from the bottom up. 11 halves to 5 remainder 1, then 2 remainder 1, then 1 remainder 0, then 0 remainder 1 — bottom to top, 1011.
Why hexadecimal exists
One hex digit is exactly four binary digits, so a byte is exactly two hex characters and nothing ever straddles a boundary. That single fact is why colours are written as six hex characters, why memory addresses look the way they do, and why hex is far easier to read aloud than a wall of ones and zeros.
Base sixteen needs sixteen symbols and the digits run out at nine, so A to F carry ten to fifteen. Case does not matter when you type it here; the answer comes back in upper case because that is the usual convention.
Large numbers, and where most converters break
An ordinary JavaScript number cannot hold a whole number above 9,007,199,254,740,991 exactly. Past that it starts rounding, and the awkward part is that it does so silently — ask most online converters for the binary of 9007199254740993 and they will confidently give you the binary of 9007199254740992.
This page uses BigInt, which has no size limit at all, so a two-hundred-digit number converts exactly. If you work with hashes, large IDs or cryptographic values, that is the difference between a right answer and a plausible one.
A note on negative numbers
A negative number is shown with a minus sign in front of its magnitude, which is the mathematical way to write it. It is not two’s complement. Two’s complement only means something once you fix a width — 8-bit, 32-bit, 64-bit — and that is a choice this page has no way to make for you.
Frequently asked questions
How do I convert binary to decimal by hand?
Write the place values from the right - 1, 2, 4, 8, 16, 32 and so on - then add up the ones that sit under a 1. For 1011 that is 8 plus 0 plus 2 plus 1, which is 11. Going the other way, keep halving and write down the remainders, then read them bottom to top.
Why does hexadecimal use letters?
Because base sixteen needs sixteen single characters and the digits only reach nine, so A to F stand for ten to fifteen. Hexadecimal is used because one hex digit is exactly four binary digits, which makes a byte exactly two hex characters. That is why colours are written as six hex characters and memory addresses as strings of them.
How large a number can it handle?
As large as you like. Most converters run out of exactness above about nine quadrillion, because ordinary JavaScript numbers cannot hold a whole number bigger than that and silently round it instead of complaining. This page uses BigInt, so a two hundred digit number converts exactly.
Is anything I type sent anywhere?
No. The conversion happens in JavaScript inside your own browser. Nothing is uploaded and nothing is saved - close the tab and it is gone.