Convert numbers between hexadecimal, decimal, binary, and octal. Perform arithmetic and bitwise operations (AND, OR, XOR, NOT) in any number base.
Exact for any length (up to 200 characters). Negative values are shown with a minus sign; use the Arithmetic tab for fixed-width two's complement.
| Base | Prefix | Value |
|---|---|---|
| Binary | 0b | 11111111 |
| Octal | 0o | 377 |
| Decimal | — | 255 |
| Hexadecimal | 0x | FF |
| Hex | Dec | Bin | Oct |
|---|---|---|---|
| 0 | 0 | 0000 | 0 |
| 1 | 1 | 0001 | 1 |
| 2 | 2 | 0010 | 2 |
| 3 | 3 | 0011 | 3 |
| 4 | 4 | 0100 | 4 |
| 5 | 5 | 0101 | 5 |
| 6 | 6 | 0110 | 6 |
| 7 | 7 | 0111 | 7 |
| 8 | 8 | 1000 | 10 |
| 9 | 9 | 1001 | 11 |
| A | 10 | 1010 | 12 |
| B | 11 | 1011 | 13 |
| C | 12 | 1100 | 14 |
| D | 13 | 1101 | 15 |
| E | 14 | 1110 | 16 |
| F | 15 | 1111 | 17 |
Priya is reading a memory dump where one byte shows 8C, and the data sheet she is checking it against lists the value as 140. A few keystrokes settle it: 8C in hex is 140 in decimal, 10001100 in binary and 214 in octal. The page also does arithmetic and bitwise operations directly in the base you pick, so FF + 1A can stay in hex instead of taking a detour through decimal.
Typical case: convert hex 8C. Each digit is worth a power of 16, and C stands for 12, so 8 × 16 + 12 = 140. In binary, 8 is 1000 and C is 1100, so the byte is 10001100. In octal, 140 = 2 × 64 + 1 × 8 + 4, which is 214. Under the hood the page reads your text as an exact big integer and writes results in capital letters.
Arithmetic works the same way. FF + 1A is 255 + 26 = 281, which is 119 in hex, 100011001 in binary and 431 in octal. Both inputs are turned into ordinary numbers, the operation is done, and the answer is shown in all four bases at once.
Edge cases. Subtract past zero and you get a signed result with a minus sign, plus a two's-complement column for the chosen width: 5 − 8 in hex is -3, and its 32-bit two's complement is FFFFFFFD. Division keeps only the whole part, truncated toward zero, so 7 ÷ 2 is 3 and -8 ÷ 3 is -2. The Arithmetic tab has a Bit width selector (8, 16, 32 or 64, starting at 32). AND, OR, XOR and NOT work on the two's-complement pattern of that width and show the result as an unsigned pattern, with the signed reading underneath. NOT F0 at 32 bits returns FFFFFF0F (4,294,967,055 in decimal, signed -241), and the four-base table fills in as for any other operation. FFFFFFFF OR 0 returns FFFFFFFF, whose signed reading is -1.
Size. Arithmetic is exact at any size, because the page uses big integers rather than ordinary floating-point numbers. Sixteen F's in a row convert to 18446744073709551615, and FFFFFFFFFFFFFFFF + 1 at 64 bits gives 10000000000000000 with a note that it wraps to 0 in the two's-complement column. Inputs must fit the chosen width, signed or unsigned: at 32 bits that means -2,147,483,648 to 4,294,967,295, and a larger value gets a message asking for a wider width. Each number is capped at 200 characters. For decimal-only work on very long integers, the Big Number calculator is simpler.
Writing a negative number as a byte is direct. Choose the 8-bit width and compute 0 − 3 in hex: the two's-complement column shows FD. The bitwise route agrees, because NOT 2 at 8 bits is also FD.
No. The boxes accept only digits for the chosen base and an optional leading minus sign, so values such as 3.7 or 0.1 cannot be typed. Everything is treated as a whole number.
No, the letter x is rejected by the input filter. Type only the digits, for example FF, and read the 0x prefix in the results table.
Not when typing. Lower-case a to f is accepted and results always come back in capitals.
Check the Bit width selector, which starts at 32. Set it to 64 for 64-bit data. Values are never cut down: an input that does not fit the width gets a message, and the signed reading of a pattern with the top bit set is shown separately from the unsigned pattern.
Split it into FF, 8C and 00 and convert each pair, which gives 255, 140 and 0. Pasting FF8C00 as one value gives 16,747,520, which is correct as a single number but not as red, green and blue.