🔢 Base Converter
Real-time conversion between binary, octal, decimal, and hexadecimal with input validation and one-click copy.
Related guide
Unit and Base Converters: Factors, Display Rounding and the Edges of the Range
The unit converter multiplies by one stored factor per unit; the base converter re-encodes an integer exactly. Both are reliable in the middle and surprising at the edges — exactly 1,000,000 switches to scientific notation, 1 PB comes out as 1023.999994 TB, and the box you type in keeps the leading zeros you gave it. Every figure below was measured on the pages themselves.
Converting between the four bases
Four fields are shown at once — binary, octal, decimal and hexadecimal — and the conversion is live. Type into any one of them and the other three update as you go; there is no convert button and no particular direction to work in. That makes the page useful in the middle of a task rather than as a separate step: paste a value, read the form you need, copy it out.
Each field carries its own copy button, so you do not have to select the text by hand, and the field accepts the digits of its own base while politely ignoring anything from another. The decimal value is also repeated underneath, which is the one people most often need to compare against.
What it does and does not accept
The converter handles whole numbers only. There is no support for fractions, signs, digit separators or the conventional prefixes that mark a base in source code — no 0x for hexadecimal, no 0b for binary, no underscores between digits. A hyphenated negative number is rejected rather than misread, which is the safer failure: a converter that silently drops a minus sign is worse than one that refuses.
Hexadecimal input is case-insensitive, so the letters can be typed either way, and the output is normalised to upper case. Leading zeros are accepted on the way in and dropped on the way out, since they carry no value — 00001010 and 1010 are the same number and both display as 1010.
The largest value handled is 9,007,199,254,740,991, which is two to the fifty-third power minus one — the point past which a JavaScript number stops being able to represent every integer exactly. Binary representations therefore run to fifty-three bits. Go beyond that and the field is flagged rather than quietly rounded, so a large value is refused instead of being converted to something subtly wrong.
Working with the fields
A typo part-way through a number is the case worth knowing about. While the value in the field you are editing is invalid it is marked, but the other three fields keep showing the last value that was valid rather than blanking or filling with nonsense. That way a half-typed entry does not destroy the result you were about to copy.
Clearing the field you are working in clears the whole set and returns to the starting prompt, and pressing Escape empties the field you are in and resets the others along with it. Clear All does the same thing from the button row.
FAQ
Does it support negative numbers?
No. Input is unsigned, so a minus sign is treated as an invalid character and the field is flagged. If you need a signed representation, convert the magnitude here and add the sign yourself.
Can I type 0x1F or 0b1010?
No — the base is implied by which field you type into, so prefixes are not accepted. Put 1F in the hexadecimal field and 1010 in the binary field instead.
Why is my large number rejected?
Values above 9,007,199,254,740,991 are outside the range this converter guarantees exactly. That number is two to the fifty-third power minus one, the largest integer a double-precision floating-point number can hold without losing precision, and refusing it is more honest than returning a rounded answer.
What happens if I make a typo?
The field you are editing is marked as invalid and the other three keep their last valid values, so a mistake part-way through typing does not clear a result you were about to copy. Correct the character and conversion resumes.
Is hexadecimal case-sensitive?
Not on input — a to f and A to F are both accepted. Output is normalised to upper case, so the four representations are consistent whichever field you typed into.
What are the common uses for this?
Colour values are the everyday case, since CSS uses hexadecimal and design tools often report decimal. Beyond that: file permission modes are traditionally written in octal, bitmasks and flags are usually hexadecimal, and character codes are read alongside all of them.