Convert numbers between hexadecimal, decimal, binary, and octal. Perform arithmetic and bitwise operations (AND, OR, XOR, NOT) in any number base.
| 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 with parseInt and writes results with Number.toString, always 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, not a two's-complement bit pattern: 5 − 8 in hex is -3, not FFFFFFFD. Division keeps only the whole part, so 7 ÷ 2 is 3. AND, OR, XOR and NOT run on 32-bit values: NOT F0 returns FFFFFF0F (4294967055 in decimal), but FFFFFFFF OR 0 displays -1 because the 32-bit pattern is read as signed. For NOT, only the highlighted result box fills in; the four-base table beneath it stays blank.
Size limit. Past 2^53, about 9 quadrillion, ordinary numbers lose digits. Sixteen F's in a row convert to 10000000000000000, which is wrong. For values that large, use the Big Number calculator and keep this page for byte, word and colour-sized work.
Writing a negative number as a byte takes a small workaround. To get -3 as 8 bits, subtract in hex: 100 − 3 = FD. The bitwise route gives the same result: NOT 2 returns FFFFFFFD, and ANDing that with FF leaves 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.
Because AND, OR, XOR and NOT are carried out on 32 bits here. Anything above 4,294,967,295 (FFFFFFFF) is cut down, and a result with the top bit set can appear negative.
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.