Number Base Converter
Convert between binary, octal, decimal, hexadecimal, and any base from 2 to 36.
| Base | Value |
|---|---|
| 2 (binary) | … |
| 8 (octal) | … |
| 10 (decimal) | … |
| 16 (hex) | … |
| 32 | … |
| 36 | … |
What is this for?
Numbers are the same value regardless of which base you write them in — 255, 0xff, 0b11111111, and 0o377 all represent the same quantity. However, the base you work in matters enormously when you're debugging, reverse-engineering data layouts, reading memory dumps, or working with protocols and file formats. This tool converts between binary, octal, decimal, hexadecimal, and any arbitrary base from 2 to 36, using BigInt arithmetic to handle large integers without precision loss.
When to use it
- Reading a hex value from a debugger, stack trace, or network packet and converting it to decimal to understand its magnitude or identify it as a known error code.
- Converting between CSS colour codes (e.g.
#ff8800or0xff8800) and RGB triplets, or vice versa. - Inspecting a bitmask or flags integer in binary to see which individual bits are set, or constructing a bitmask from a set of bit positions.
- Translating between base-36 shortened IDs (like URL slugs or API tokens) and their underlying decimal counters.
- Working with memory addresses, pointers, or offsets displayed in hex and needing to verify them in decimal.
- Converting between different data encodings — base-16 for byte streams, base-2 for bit-level operations, base-8 for legacy Unix permissions.
How it works
- Enter a number in any supported base. Type a decimal integer, a hex string with
0xprefix, binary with0b, octal with0o, or any base-2 through base-36 value. Underscores can be used for digit grouping (1_000_000) and are automatically stripped. - The tool parses and validates your input. It recognises common prefixes, handles both upper and lower case input, and rejects invalid digits for the chosen base.
- Conversion happens via BigInt internally. The input is parsed as a BigInt, then converted to every other base and displayed. This ensures perfect accuracy even for numbers larger than JavaScript's native
Numbertype can handle. - Results are shown in all common bases. You'll see decimal, binary, octal, hexadecimal, and base-36 side by side. Copy whichever format you need.
Common gotchas
- Negative numbers are sign-prefixed, not two's complement.
-128displays as-10000000in binary, not as10000000. This matches how most languages handle arbitrary-precision integers; if you need fixed-width two's complement (e.g. for 8-bit or 16-bit values), interpret the output accordingly. - Big numbers don't lose precision. JavaScript's native
Numbertype only safely stores integers up to 253 − 1. This tool usesBigInt, so 64-bit integers, cryptographic hashes, and other large values round-trip exactly. - Hex output is uppercase; base-32 and base-36 are lowercase. The tool normalises output for readability. If you need a specific case, adjust in your application code. Input is case-insensitive.
- Leading zeros are dropped.
0x000FbecomesF. If you need fixed-width output (e.g. for byte pairs likeFF 8B), pad the result in your code after copying. - Base-36 uses 0–9 and a–z. It's commonly used for compact representations of large integers and IDs, but isn't a standard encoding — always confirm the base with your data source.