Base / Radix Converter
Convert between 2/8/10/16 and any 2–36 bases, with BigInt for large numbers and grouped binary output.
Base / Radix Conversion: Hex Digits, Bits, and the Byte Boundary
Conversion is positional notation
The same value writes differently in different bases. 255 in binary is 11111111, in octal is 377, and in hex is FF. They are one number; only the weight per digit changes (powers of 2, 8, or 16 respectively).
So base conversion does not change the value, only its written form — exactly like "255" and "0xFF" being the same number.
Why programmers use hexadecimal
The key point: one hex digit maps exactly to 4 bits (since 16 = 2⁴), and a byte is 8 bits, so one byte is two hex digits. That clean mapping makes reading and writing trivial:
| Binary | Hex | Decimal | Note |
|---|---|---|---|
1010 | A | 10 | 4 bits = 1 hex digit |
11111111 | FF | 255 | 1 byte = 2 hex digits |
1010 1010 | AA | 170 | Grouped for eyeball checking |
Write the same byte in decimal and you cannot see the bit pattern at a glance. That is why memory addresses, color values (#FF5733), hashes, character encodings, packet analysis, and permission masks all use hex.
This tool groups binary output every 4 bits with a space, precisely to match that mapping — one group is one hex digit, easy to verify by eye.
Bit-width reference
| Width | Unsigned range | Signed range (two's complement) |
|---|---|---|
| 8 bit | 0 – 255 (0xFF) | −128 – 127 |
| 16 bit | 0 – 65535 (0xFFFF) | −32768 – 32767 |
| 32 bit | 0 – 4294967295 (0xFFFFFFFF) | −2147483648 – 2147483647 |
| 64 bit | max ≈ 1.8 × 1019 | ≈ ±9.2 × 1018 |
Seeing 0xFF should instantly suggest 255 (a byte fully set); 0xFFFFFFFF suggests a 32-bit field fully set — basic intuition when reading code and logs.
Important concept: the same bit pattern means different numbers under signed versus unsigned interpretation. For example 0xFF: unsigned is 255, signed two's-complement is −1. So "FF means 255" is wrong wherever signed types are involved. Negative numbers in two's complement set the top bit to 1, a common source of overflow bugs.
Why BigInt is needed
JavaScript numbers are IEEE 754 doubles, which represent integers exactly only up to 253 − 1 = 9007199254740991. Beyond that, integer math loses precision — fatal for base conversion, because crypto-related values (hashes, keys, blockchain addresses) routinely exceed it.
This tool uses BigInt, so it is free of the 253 limit and handles arbitrarily long integers while memory allows. You can safely convert 64-bit, 128-bit, or longer integers without trailing digits turning to zero or garbage.
Common mistakes
- A character outside the base. Entering
2in binary orGin hex is illegal. The tool reports the error and position rather than silently truncating. - A prefix read as part of the value.
0x(hex),0b(binary),0o(octal) are language literals, not the number. Strip the prefix before converting to decimal, or thexin0xis flagged illegal. - The octal trap in loose-typed languages. JavaScript historically read a leading-
0number as octal, so0777was 511, not 777. Strict mode dropped this, but legacy code still shows it — a historical source of "the number changed". - The base ceiling is 36. Usable characters are 0–9 plus A–Z, 36 total. base32 and base64 are not bases — they are bit-grouping encodings (base64 uses 64 chars for 6-bit groups); the number in the name means something else.
- Negatives need a convention. Pure base conversion targets non-negative integers. How a negative is represented (sign bit, two's complement, bias) is a data-representation choice, not a base question; agree on it first.
How to use the tool
- Enter the number in the value box (e.g.
1010orFF). - Pick the from-base and to-base; any base from 2 to 36 is supported.
- Convert. Binary output groups every 4 bits for easy hex comparison.
It fits bit-mask verification (turn a hex mask into binary and count which bits are 1), color-value conversion, permission decoding, and checking received hex data. All runs locally in the browser.
FAQ
How large a number is supported?
BigInt is used, so any integer length is handled as long as memory allows, free of the 2^53 limit.
Why group the binary output?
Binary gets very long; grouping every 4 bits (a nibble) with spaces aids reading and manual checking.