Convert binary, decimal and hexadecimal
Convert numbers between binary, octal, decimal, hexadecimal and any base up to 36, of any size, with two’s complement for negative numbers.
Convert numbers between binary, octal, decimal, hexadecimal and any base up to 36, of any size, with two’s complement for negative numbers.
Runs entirely in your browser: nothing you type is sent or stored.
255 is 2 × 100 + 5 × 10 + 5. Any base works the same way with its own multiplier: in base 2, 1101 is 8 + 4 + 0 + 1 = 13; in base 16, FF is 15 × 16 + 15 = 255. Above 9, letters serve as digits: A is 10, F is 15, Z is 35, which is why base 36 is the largest one.
0b1010 for binary, 0o17 for octal (or a leading zero in C), 0xFF for hexadecimal. Most languages also accept underscores as separators, as in 1_000_000; this converter reads them too, and the numbers can be as large as you like.
#FF8800 is red 255, green 136, blue 0), memory addresses (0x7FFE5A3C), MAC addresses, hashes from the hash generator, and the escapes of the URL encoder.
755, each digit holds the read, write and execute bits of one class of users. The chmod calculator explains them.
1111 1111 (FF) and -42 is 1101 0110 (D6). The leftmost bit gives the sign, so a signed byte goes from -128 to 127, and the same bits read as unsigned go from 0 to 255.
FF is 255 unsigned but -1 in a signed byte. This explains overflows, such as a counter jumping from 2147483647 to -2147483648 in a 32-bit integer.
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
0000 | |||
0001 | |||
0010 | |||
0011 | |||
0100 | |||
0101 | |||
0110 | |||
0111 | |||
1000 | |||
1001 | |||
1010 | |||
1011 | |||
1100 | |||
1101 | |||
1110 | |||
1111 | |||
10000 |