Number Base Converter

Convert integers between binary, octal, decimal and hexadecimal with BigInt precision — exact far beyond the float limit, with digit-level error messages. Free, no sign-up — runs locally in your browser.

Binary (base 2)
Octal (base 8)
Decimal (base 10)
Hexadecimal (base 16)

Why hexadecimal keeps showing up

Computers count in binary because a wire is on or off; humans cannot read binary because a byte is eight digits and a 64-bit value is sixty-four. Hexadecimal is the treaty between the two: each hex digit is exactly four binary digits, so a byte is always two hex digits and any binary value converts by simple grouping — no arithmetic, no drift. That is why memory addresses, colour codes, MAC addresses, hash digests and UUIDs are all written in hex, and why octal survives mainly in Unix file permissions (three bits per digit, one digit per permission trio). This converter shows all four bases at once because the commonest task is not converting one number but recognising that FF, 377, 255 and 11111111 are the same number in four costumes.

How to use this converter

  1. Type or paste the value and pick the base it is written in. All four bases update live — there is nothing to submit.
  2. Prefixes are welcome when they match the selected base: 0xFF as hexadecimal, 0b1010 as binary. A leading minus sign works in every base.
  3. If something is not a digit in the chosen base, the error names the character and its position instead of failing silently — check the character, or check the base.
  4. Copy any row with its button. The binary, octal and hexadecimal rows copy with their 0b/0o/0x prefix ready to paste into code; decimal copies bare.

Exact at any size

Most quick converters are built on floating-point numbers, which represent integers exactly only up to 253. Beyond that, they do not error — they approximate, and the last digits of the output are quietly invented. The values people most need to convert — 64-bit IDs, timestamps in nanoseconds, cryptographic material — live exactly in that beyond. This page therefore converts with BigInt, JavaScript's arbitrary-precision integer type, parsing digit by digit: a 100-digit decimal converts to hex and back with every digit intact, which you can verify with the "2⁶⁴ + 1" example above — the value float arithmetic famously cannot represent. If a number matters enough to convert, it matters enough to convert exactly.

Frequently asked questions

Why does this converter use BigInt?

Because ordinary JavaScript numbers are double-precision floats and stop being exact integers beyond 2^53 (9,007,199,254,740,992). Paste a 64-bit value like 18446744073709551617 into a float-based converter and it silently becomes …616, so the hex it shows you is wrong in the last digit — the worst kind of wrong, because nothing looks amiss. This page converts with BigInt arithmetic digit by digit, so values of any length — 256-bit hashes, 128-bit identifiers — convert and round-trip exactly. Try it: convert a long hex string to decimal and back, and you get your original digits.

What prefixes are accepted?

The matching prefix for the base you selected: 0b for binary, 0o for octal and 0x for hexadecimal (any letter case), plus an optional leading minus sign for negative values. A prefix that does not match the selected base is not quietly ignored — "0xFF" entered as decimal fails with an error naming the "x", because silently stripping characters is how conversion tools produce confident wrong answers. Spaces inside the digits are likewise rejected with the position named.

Why does it say my digit is invalid?

Each base only owns some digits: binary has 0–1, octal 0–7, decimal 0–9, hexadecimal 0–9 and A–F. The classic mistake is pasting hex into the decimal box (the letter F is not a decimal digit) or binary containing a 2. The error names the offending character and its position, so you can see whether the input is wrong or the base selection is — nine times out of ten it is the base selection, which is why the four outputs below always show all bases at once.

Does it handle negative numbers and fractions?

Negative integers, yes: a leading minus is honoured and carried into all four outputs as a minus sign (sign-and-magnitude notation, which is how humans read negative hex — two's complement is a storage representation, and if you need it, convert the unsigned value your width implies). Fractions, no: this is an integer converter, and a decimal point is reported as an invalid digit rather than truncated, because silently dropping ".75" would be a lie by omission.

Is my input saved or sent anywhere?

Neither. The conversion runs locally in your browser, and this tool keeps no draft — the values people convert are often identifiers or fragments of keys, and the honest default for those is to forget them. Close the tab and nothing remains.

Related tools

Related guides