How positional bases work
In any base, each place is worth the base times the place to its right. In decimal, 255 is 2×100 + 5×10 + 5. In binary the places are 1, 2, 4, 8 and so on, so 11111111 is 255. In hexadecimal they are 1, 16, 256…, and the digits run 0–9 then A–F, so FF is 15×16 + 15 — also 255. Bases above 16 carry on through the alphabet, which is why 36, ten digits plus 26 letters, is the usual limit.
Why programmers use hex
One hexadecimal digit is exactly four bits, so two hex digits make one byte. That makes hex a compact way to read binary data: colour codes (#FF8800), memory addresses, MAC addresses and file signatures are all written in it. Octal, three bits per digit, survives mainly in Unix file permissions — the 755 in chmod 755.
Large numbers stay exact
JavaScript’s ordinary numbers are exact only up to 2⁵³ − 1, about nine quadrillion. Past that, a converter built on them quietly returns a neighbouring value, so a 64-bit ID comes back wrong. This converter uses arbitrary-precision integers, so a value of any length converts exactly.
Negative numbers and two’s complement
Mathematically, −5 in binary is −101. Computers instead store negative integers in two’s complement: invert the bits of the positive value and add one, within a fixed width. −1 is 11111111 in 8 bits and FFFFFFFF in 32. For a negative input the converter shows both the signed value and its two’s complement pattern at 8, 16, 32 or 64 bits.