Number Base Converter: Hex, Binary, Octal, Decimal
Last updated:
Convert integers between decimal, hex, octal, and binary with exact BigInt math, and see the same bits as signed and unsigned at 8, 16, 32, and 64 bits. Also flags numbers that JSON.parse would silently corrupt. All in your browser, nothing uploaded.
How it works
A bit pattern has no sign until you pick a width. 0xFF is 255 as an unsigned byte and −1 as a signed one, because signed integers use two’s complement: the top bit counts as negative. The table shows every input at 8, 16, 32, and 64 bits, read both ways:
| Bits | As int8 / int32 | As uint8 / uint32 |
|---|---|---|
0xFF |
−1 | 255 |
0x80 |
−128 | 128 |
0xFFFFFFFF |
−1 | 4,294,967,295 |
A value that doesn’t fit wraps around when it’s stored: 300 in a uint8 becomes 44 (300 − 256). That’s what the “overflows: wraps” rows show. The same rule is behind the year-2038 problem: a signed 32-bit Unix timestamp tops out at 2,147,483,647 seconds and wraps to a negative number.
- Big numbers are exact. Everything runs on JavaScript
BigInt, so a 64-bit ID or a 300-digit number converts digit for digit. A plain JSNumbercan’t do that past 2^53 − 1 (9,007,199,254,740,991):JSON.parseturns 9007199254740993 into 9007199254740992 without an error. That’s how 64-bit database IDs get corrupted in a browser, and why APIs like X’s send IDs as strings too. When your number is past that limit, the result shows what JS would turn it into. - A leading zero isn’t octal here. In C, Python 2,
chmod, and older JavaScript,0755means octal 493. This tool reads a bare0755as decimal and adds a note saying so. Write0o755or pick Oct to mean octal. - Byte order. Network protocols and most file formats store the most significant byte first (big-endian); x86 and ARM memory stores the least significant first (little-endian). Both orders are listed, so you can match the value against a hex dump either way.
- Prefixes
0x,0o, and0bare detected in Auto mode, and_, spaces, and thousands commas are ignored, so0b1111_0000and1,000,000both work.
Whole numbers only. Fractions generally have no exact binary form (0.1 repeats forever in base 2), and how floats are laid out in memory is a different topic. Runs entirely in your browser; nothing you type is uploaded or stored.