What Each Base Is For
- Binary (base 2) — bit flags, masks, and the mental model behind everything else.
- Octal (base 8) — file permissions:
755,644,umask 027. - Decimal (base 10) — what every API and log line shows you.
- Hex (base 16) — colours (
#1e40af), MAC addresses, memory addresses, Unicode code points (U+1F600), and the byte dumps you read in a debugger.
Prefix Cheat Sheet
Most languages accept a prefix that states the base outright, which is why 0x1F, 0b11111, 0o37 and 31 all mean the same number. Paste a prefixed value into the matching field here and it is stripped for you.
💡 Pro Tip: 32-Bit Bitwise Truncation
JavaScript's bitwise operators squeeze operands into 32 bits, so (2**32) | 0 is 0 and (2**31) | 0 is -2147483648. Any flag or ID above 231 that passes through |, & or >> silently changes value. Use BigInt and the n variants (&n, >>n) when you actually mean 64 bits.
Frequently Asked Questions
Why does converting a large hex value give me a number ending in zeros?
You converted through a float. parseInt('FFFFFFFFFFFFFFFF', 16) returns 18446744073709552000 because a double can only hold 53 bits of integer precision — the real value is 18446744073709551615. Anything past Number.MAX_SAFE_INTEGER (9,007,199,254,740,991) is rounded. This tool parses with BigInt, so the sixteen F's come back exact.
How do I show a negative number in hex?
There is no single answer — you have to choose a width. (-1).toString(16) in JavaScript returns "-1", while (-1 >>> 0).toString(16) returns "ffffffff" (32-bit two's complement). The meta line under the fields shows the 32-bit and 64-bit unsigned forms so you can copy the one your protocol expects.
Does parseInt('08') still mean octal?
No. Since ES5, parseInt('08') is 8 and parseInt('010') is 10 — the legacy octal default is gone. Octal now requires an explicit radix or the 0o prefix. Watch out for the sibling trap: parseInt('12px') is 12 (it stops at the first invalid character) while Number('12px') is NaN.
Can I convert fractional values like 10.5?
This tool is integer-only, on purpose: base conversion of fractions is where most "wrong" answers come from. (255.5).toString(16) is "ff.8", but (1234.567).toString(2) produces a 40-plus digit tail that is really the binary of a binary64 float, not of 1234.567. Convert integers exactly, and scale (cents, milliseconds, basis points) instead of converting fractions.
How many bytes does my number take?
The meta line reports the minimum byte width: 0–255 fit in one byte, up to 65,535 in two, up to 16,777,215 in three, and 4,294,967,295 in four. Wire formats usually round up to a power of two, which is why a value that fits in 5 bytes is normally sent as 8.
Is anything sent to a server?
No. The conversion runs entirely in this page with BigInt arithmetic — no requests, no analytics on the values, no logs. You can open the page, disconnect from the network, and it still works.