Skip to main content
QUIETLYTIC
Encoding & Data

Binary, Decimal & Hex Converter

Convert a number between binary, octal, decimal and hexadecimal.

Local · nothing leaves this browser Waiting for a number
Esc Clear
Every base, and how wide it is

Enter a value on the left.

How it works

Every conversion here runs on arbitrary-precision integers, which is the only detail about this tool that matters. JavaScript numbers are exact only up to 253 − 1, and the usual conversion routines return an approximation past that point without saying so. A 64-bit timestamp, a snowflake ID or a hash fragment is well past it, so a converter that rounds gives you a wrong answer that looks exact.

Width, signed and unsigned

Alongside each base is the number of bits the value needs and the fixed-width integer types it fits in. 255 fits an unsigned byte and not a signed one, whose ceiling is 127 — the kind of boundary that produces a bug two layers away from where it was introduced.

Prefixes must match the base

0x, 0b and 0o are accepted when they match the base you selected, because people paste 0xFF far more often than FF. A prefix for a different base is an error rather than a guess: 0x10 read as decimal is 10 and read as hex is 16.

Example

ffffffffffffffff in hex is 18446744073709551615 — the largest unsigned 64-bit value, exact to the last digit. Convert it with anything built on floating point and you get 18446744073709551616, which is both wrong and one larger than the maximum it claims to represent.

Frequently asked questions

Does it lose precision on large values?

No. Every conversion runs on BigInt, so a full 64-bit value is exact. JavaScript numbers lose precision above 2^53 - 1, and parseInt returns an approximation past that point without saying so — which is precisely the failure this tool exists to avoid.

What do the width rows mean?

Which fixed-width integer types the value fits in, unsigned and signed separately. 255 fits an unsigned byte but not a signed one, whose ceiling is 127 — the kind of boundary that produces a bug two layers away from where it was introduced.

Can I paste a prefixed value like 0xFF?

Yes, when the prefix matches the base you selected. A prefix for a different base is an error rather than a guess: 0x10 read as decimal is 10 and read as hex is 16, and quietly picking one produces a wrong answer that looks right.

Related tools

From the intelligence desk