Como funciona
Positional notation is the same algorithm in every base: the value is the sum of each digit multiplied by the base raised to the digit's position. Converting from decimal to another base extracts digits by repeated division and remainder, and converting into decimal accumulates by repeated multiplication and addition. The reason this is worth doing with BigInt rather than with ordinary numbers is that JavaScript numbers are IEEE-754 doubles with 53 bits of exact integer precision, so a 64-bit value such as a Twitter snowflake ID or a large hash silently loses its low bits the moment it is parsed — 9007199254740993 becomes 9007199254740992, and the corruption is invisible until the value fails to match.
Negative numbers have no single hexadecimal representation; the word size decides. In a 32-bit two's complement scheme, minus one is FFFFFFFF, while in 64 bits the same value is FFFFFFFFFFFFFFFF, and in 8 bits it is FF. All three are correct and none is meaningful without knowing the width. This is not a theoretical concern: a protocol that specifies a signed 32-bit field, a checksum computed over 16-bit words and a file format storing 64-bit little-endian integers will each expect a different rendering. The bit-width view makes the choice explicit and shows signed and unsigned readings side by side.
Bit-level interpretation is what turns a conversion tool into a debugging tool. Bit length tells you how many significant bits a value has, which reveals whether a flag was set or a value overflowed its intended field. Population count — the number of set bits — is used in hash quality checks and error-correcting codes. Reading the same 32 bits as an IEEE-754 float is how you discover that a value of 1065353216 in a register is actually 1.0, a trick that comes up constantly when reverse-engineering a binary format or debugging a serialisation mismatch.
The alphabet-based encodings are a different family and are included because they are routinely confused with the numeric ones. Base32, Base58, Base62 and Base64 encode a byte string rather than a number, using a fixed character set to make binary data safe for transport. Base58 in particular omits the characters that look alike in print — zero, capital O, capital I, lowercase l — which is why Bitcoin addresses use it and why a base-58 string pasted from a screenshot is less likely to be mistyped. What they have in common with a base conversion is only the idea of a positional alphabet.
Casos de uso comuns
- Convert a hex colour, memory address or bitmask to decimal and back.
- Read a 64-bit identifier from a log file without losing precision to a floating-point conversion.
- Work out what a negative number looks like as a signed hexadecimal value at a specific word size.
- Interpret a register value as an IEEE-754 float to check a serialisation format.
- Convert a permissions bitmask to binary to see which individual bits are set.
- Encode a byte string in Base58 or Base62 for a system that uses a compact alphabet.
Última atualização: 2026-10-14 — o corpo do artigo é exibido em inglês; a interface está traduzida.