Number Base Converter
Convert numbers between binary, octal, decimal, and hexadecimal.
Convert numbers between binary, octal, decimal, and hexadecimal. Enter your numbers and get an instant result.
Type a value, choose whether it is decimal, binary, hexadecimal or octal, and this page prints the same number in all four bases, each with its own copy button.
Hex is written in uppercase and binary has no separators, so the output is ready to paste into code rather than formatted for reading. Every value changes as you type, with no server call.
The parser is JavaScript's parseInt with the chosen radix. It reads from the start of the text and stops at the first character the base does not allow, which is why an invalid digit can quietly shorten the number instead of producing an error.
What parseInt does with your input
A leading run of valid digits is converted; the rest is ignored. In base 8, the text 19 parses as 1 because 9 is not an octal digit, and in base 2 the text 102 parses as 2 in decimal. Only an input with no valid leading digit raises the invalid-format message.
The page does not accept fractions, signs beyond a leading minus, or a base outside the four buttons. A fractional part is therefore not converted, and the result stays an integer.
- Bases 10, 2, 16 and 8, chosen from four buttons
- Output in decimal, uppercase hex, binary and octal
- A copy button for each of the four results
The precision ceiling
parseInt produces a double-precision number, so integers above roughly nine quadrillion lose exactness before they are re-printed. A very large hexadecimal value can therefore come back with its last digits changed.
For values inside that range the conversion is exact and round-trips cleanly between all four bases.
How to use the value and bases
Type the value into the Value field, e.g. 255, press the source base button, Dec (10), Bin (2), Hex (16) or Oct (8), and read the same number in all four bases in the Converted Values panel, each with its own Copy button. Every value changes as you type with no server call; hex prints uppercase and binary without separators.
The parser is parseInt with the chosen radix: it reads a leading run of valid digits and ignores the rest, so 19 in base 8 parses as 1 and only an input with no valid leading digit raises the invalid message. Fractions, other bases, and integers past about nine quadrillion are outside what the page converts.
What to Expect
Best for
- Converting a byte value between decimal and hex
- Checking a binary mask against its decimal form
- Getting an octal or hex literal for a configuration file
Not ideal for
- Arbitrary-precision integers, which lose exactness past the double range
- Fractional numbers, which are not converted
- Validating that an input is well-formed rather than merely parseable
What this tool keeps
- The same value in all four bases at once
- A leading valid digit run even when the rest is invalid
- Uppercase hex, ready to paste
What may need cleanup
- A truncated value caused by an invalid digit
- Changed low digits on an integer beyond the double range
- A sign or prefix that parseInt did not expect
Common errors
- Typing 19 in octal and reading the result as nineteen
- Expecting an error for a partially invalid input
- Converting a very large number and trusting every digit
Example use cases
- Reading a permission mask in octal
- Converting a colour channel between decimal and hex
- Checking a binary flag against its decimal value
Sample input
Type 255 with decimal selected and read the four results.
Sample output
Decimal 255, hexadecimal FF, binary 11111111 and octal 377, each with its own copy button.
Who this is for
- Developers reading masks and flags
- Students learning positional number systems
- Anyone converting a literal between bases
Frequently asked questions
Which bases does the number converter show?
The same value in decimal, binary, hexadecimal and octal at once, each with its own copy button.
Can it handle arbitrary-precision integers?
No. Past the browser's double range, low digits can change.
Does it reject invalid input?
It parses the leading valid digit run and shows the value, so the rest of an invalid string can be silently ignored.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.