toolready. Number Base Converter

Number Base Converter

Translate numbers between binary, octal, decimal, and hex.

What this does

Four linked fields — decimal, hex, binary, octal — plus a fifth for any base you name. Type into one and the other four rewrite themselves immediately; there's no direction to pick and no convert button. The page opens on decimal 255, which is ff, 11111111 and 377. Every field but the custom one has a copy button. The arithmetic runs in your browser on BigInt, so nothing is sent anywhere and nothing is rounded.

How do I convert hex to decimal?

  1. Clear the Hex (16) field and type your value — case doesn't matter, FF and ff both work.
  2. Read the answer off the Decimal row; binary and octal fill in at the same time.
  3. Press copy beside the row you want.

A leading 0x, 0b or 0o is stripped before parsing, so you can paste a literal straight out of source code. Output never carries a prefix and is always lowercase.

Which bases are supported?

Anything from 2 to 36. Digits run 0–9 then a–z, which is why 36 is the ceiling — that's every digit and letter used up. Set the Custom base spinner to 3 for ternary, 12 for duodecimal, 32 for base32 or 36 for the shortest form. Type 1 or 40 and it's clamped back into range rather than erroring, so check what you actually set. Base 64 isn't on this list: Base64 encodes bytes with its own alphabet and padding, so it lives in the Base64 encoder.

Can it convert 64-bit values without rounding?

Yes, exactly. Ordinary JavaScript numbers stop being reliable above 9,007,199,254,740,991 — the 253 safe-integer limit — which is why so many converters mangle 64-bit values. This one accumulates digits into a BigInt, so a full 64-bit word is precise:

hex      ffffffffffffffff
decimal  18446744073709551615
octal    1777777777777777777777
binary   1111111111111111111111111111111111111111111111111111111111111111

A 256-bit hash converts to its 78-digit decimal the same way. If what you actually want is the hash itself, see the hash generator.

How are negative numbers handled?

As sign and magnitude. A leading - is carried through, so decimal -255 shows as -ff in hex and -11111111 in binary. That is not two's complement — it won't tell you an 8-bit -1 is 11111111 or a 32-bit -1 is ffffffff, because two's complement needs a word width the tool can't know. Reading a signed register? Add 2n yourself and convert that. A sign combined with a prefix, as in -0xff, is rejected; drop the 0x.

Can I convert 10.5 or a decimal fraction?

No — this is an integer converter. A decimal point isn't a valid digit in any base, so 10.5 comes back as Invalid digit for base 10 rather than being silently truncated, which is the safer failure. Convert the whole and fractional parts separately, remembering that most decimal fractions don't terminate in base 2.

Why won't my input convert?

The whole string must be digits legal for that base, optionally with one leading minus. Common causes of the error line: a digit out of range (a 2 in binary, a g in hex), spaces or underscores used as separators (ffff ffff — remove them), a trailing h or b from assembler syntax, and a # pasted with a colour. Strip the # and hex colours convert fine, though the colour converter does the RGB split for you. While an input is invalid the other fields keep their last good values, so read the error line before trusting the screen.