Binary, Hex, Octal and Decimal Converter
Type into any field and the rest update. Conversion uses arbitrary-precision integers, so a 200-digit number comes back exact rather than rounded, which is where most quick converters quietly give up.
2 to 36. Digits run 0 to 9, then a to z.
Fixed-width and two's complement
| Width | Stored as hex | Read as unsigned |
|---|
What a base actually is
Every positional numeral system works the same way: each place is worth the base times the place to its right. In decimal, 255 means two hundreds, five tens and five ones. In binary, 11111111 means one of each power of two from 128 down to 1, which comes to the same 255. Nothing about the quantity changes. Only the notation does.
Hexadecimal exists for one reason: 16 is 2 to the fourth, so one hex digit maps to exactly four bits and never straddles a boundary. That makes FF and 11111111 mechanically interchangeable, one digit at a time, with no arithmetic. It is why memory dumps, color codes and MAC addresses are all written in hex — it is binary you can read out loud.
Octal groups three bits instead of four. It mostly survives in Unix file permissions, where chmod 755 is three octal digits, each one three permission bits: 7 is 111, read, write and execute; 5 is 101, read and execute, no write. Once you see the bits, the numbers stop looking arbitrary.
Why this tool does not use parseInt
The obvious way to build a base converter in a browser is parseInt(s, base) and Number.prototype.toString(base). Both route through a double-precision float, which holds integers exactly only up to 2 to the 53rd power, about 9.007 quadrillion. Past that, digits are silently replaced with whatever the nearest representable value happens to be.
The famous demonstration is that 9007199254740993 cannot be represented at all, so a converter built this way will hand back 9007199254740992 without complaining. This tool parses and divides using BigInt instead, digit by digit, so a hash, a UUID as an integer or a 300-digit test value converts exactly. There is no upper limit other than how long you are willing to wait.
Two's complement, and why there is one more negative
Hardware has no minus sign. A fixed-width signed integer stores negatives by wrapping: in 8 bits, -1 is stored as 255, which is FF. The rule is to take the value modulo 2 to the width, and read the top bit as the sign. That single convention lets the same addition circuit handle signed and unsigned numbers, which is the whole reason it won.
It also explains an asymmetry that catches people out. An 8-bit signed integer runs from -128 to 127, not -128 to 128. Zero takes up one of the positive slots, so there is exactly one more negative value than positive. Negating the most negative number overflows back to itself. The panel above shows what the current value looks like at 8, 16, 32 and 64 bits, and says plainly when it does not fit.
Base64 is not base 64
Despite the name, Base64 is not a positional numeral system and this tool will not produce it. It is a binary-to-text encoding: it takes three bytes, splits the 24 bits into four groups of six, and maps each group to one of 64 printable characters. It works on a byte stream, not on the value of a number, which is why the Base64 encoder is a separate thing entirely.
What this tool will not do
- Fractions. Integers only. Base conversion of a fractional part is possible but rarely what anyone wants, because most fractions do not terminate in the target base. A tenth is 0.0001100110011... repeating forever in binary, which is the same reason adding 0.1 and 0.2 in almost any language does not give exactly 0.3.
- Bases above 36. There is no agreed alphabet beyond 0 to 9 and a to z. Base58 and Base62 both exist, with their own hand-picked character sets that deliberately exclude lookalike characters, and they are not compatible with each other.
- Float bit patterns. Converting 3.14 to its IEEE 754 hex representation is a different operation from converting an integer, and this tool does not do it.
- Silent cleanup. Spaces, underscores and commas are stripped from input, and a leading
0x,0oor0bis accepted. Anything else that is not a valid digit for the chosen base is rejected rather than guessed at.
Frequently asked questions
How do I convert binary to hex by hand?
Split the binary into groups of four bits starting from the right, padding the left group with zeros, then write each group as one hex digit. 11111111 becomes 1111 1111, which is F and F, so FF. It works because 16 is exactly 2 to the fourth.
Does it handle numbers bigger than 2^53?
Yes, exactly, at any length. Conversion uses BigInt arithmetic rather than parseInt, which routes through a float and starts losing digits above about 9 quadrillion. Paste a 100-digit number and every digit comes back.
Why does chmod use octal?
Because permissions come in groups of three bits: read, write, execute. One octal digit is exactly three bits, so 755 is 111 101 101, meaning full access for the owner and read plus execute for everyone else.
Can it convert decimals like 3.75 to binary?
No, integers only. Most fractions do not terminate in binary, so the answer would have to be truncated somewhere arbitrary. That repeating expansion is also why 0.1 plus 0.2 does not give exactly 0.3 in most programming languages.
Is Base64 the same as base 64?
No. Base64 is a text encoding that maps every six bits of a byte stream to a printable character. It does not treat the input as a number at all, so a base converter cannot produce it.
Last updated September 19, 2026