Number base converter
Convert an integer across binary, octal, decimal, hex, and one custom base 2-36. Live, exact, local.
What this tool does
Converts a whole number between binary, octal, decimal, and hexadecimal, plus one extra field for any base from 2 to 36. It is two-way and live: type a valid value in any box and every other box updates instantly. Hexadecimal output is uppercase. Everything runs in your browser using JavaScript BigInt, so values are exact no matter how large. A number such as 2 to the 80th power converts with no rounding, unlike the usual parseInt or Number path that loses precision above 2 to the 53rd.
How to use it
Put your number in the field that matches the base you already have. To convert
hex to decimal, type into the Hexadecimal box and read the Decimal box. To convert
binary to decimal, type into the Binary box. For an unusual base, pick it in the
Custom base dropdown and use the field beside it. Only the digits legal for that
base are accepted: typing a 2 in the Binary field, or a G
in the Hexadecimal field, shows an inline error and leaves the other fields
untouched. Press Clear to empty every field.
Common use cases
- Reading a hex color code or byte value as a plain decimal number.
- Checking what a binary bit pattern equals in decimal or hex.
- Converting a large 64-bit or 128-bit hex constant without precision loss.
- Working with permission bits, flags, and masks written in octal or binary.
- Decoding short ids that use base 32 or base 36 alphabets.
Common pitfalls
- Sign-magnitude is not two's complement. A leading minus here
gives sign-magnitude: a minus sign in front of the magnitude digits. Real
hardware stores signed integers as fixed-width two's complement, where, for
example, the 8-bit pattern
11111111means -1, not 255. Fixed-width two's complement depends on a chosen bit width (8, 16, 32, 64) and is a separate concept from the arbitrary-precision, sign-magnitude view this tool shows. - Leading zeros do not change the value. Binary
00001010and1010are both decimal 10. The tool normalizes output without padding, so it will not preserve a fixed field width. - Integers only. There is no decimal point or fraction support. Fractional base conversion has its own rounding rules and is intentionally out of scope.
- Base 36 is the ceiling. The digit set is 0-9 then A-Z, which runs out at base 36. Bases above 36 would need extra symbols and are not supported.
Frequently asked questions
- How do I convert hex to decimal (or decimal to hex)?
- Type the value into the field for the base you have. If you have a hexadecimal number, type it in the Hexadecimal box; the Decimal box (and every other box) updates instantly. It works both ways: type a decimal number and the Hexadecimal box shows the same value in base 16. The same is true for binary to decimal, octal to decimal, and any pairing you like. For example, decimal 255 becomes FF in hex, 11111111 in binary, and 377 in octal.
- Why use BigInt instead of parseInt or Number?
- JavaScript numbers are IEEE 754 doubles and can only represent integers exactly up to 2 to the 53rd power (about 9 quadrillion). Above that, parseInt and Number silently round, so a 64-bit hex value or a long binary string would convert wrong. This tool parses and formats every value with BigInt, which is arbitrary precision, so even a 256-bit number round-trips exactly with no lost digits.
- What does the custom base field do?
- Pick any base from 2 to 36 in the dropdown and the fifth field converts to and from that base. Bases above 10 use letters as digits: A is 10, B is 11, and so on up to Z which is 35. Base 36 is the largest that fits in the digits 0-9 and A-Z. Base 32 and base 36 are common in short id and encoding schemes.
- Does it handle negative numbers?
- Yes. Put a leading minus sign in front of any value and every field shows the negative equivalent in sign-magnitude form, meaning a minus sign followed by the digits of the magnitude. Note that this is different from fixed-width twos complement, which is how CPUs and languages actually store signed integers in a fixed number of bits. See the pitfalls section below for the distinction.
- Why is the hex output uppercase?
- Uppercase hex (0-9 and A-F) is the most common convention for color codes, memory addresses, and hashes, and it is easier to scan than lowercase. Parsing is case-insensitive, so you can paste lowercase hex like ff and it still reads correctly; the tool just normalizes the output to uppercase.
- Can it convert fractions or decimal points?
- No. This is an integer converter. Fractional values like 3.14 or binary fractions are a separate problem with their own rounding concerns, so they are intentionally out of scope. Enter whole integers only, optionally with a leading minus sign.
Cite this tool
For academic, journalistic, or technical references. Pick a format:
Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.