Number Base Converter
Convert whole numbers of any size between decimal, hexadecimal, binary, octal and any base up to 36, and read their bytes, bit widths and two's complement.
How Number Bases Work
A number base, or radix, is how many digits a way of writing numbers uses. Decimal has ten, 0 to 9. Binary has two, the ones and zeros a computer stores. Hexadecimal has sixteen, 0 to 9 and A to F, so that each digit stands for exactly four bits and a byte is always two digits.
The value does not change with the base, only the way it is written: 255, FF, 11111111 and 377 are one and the same number.
- Type into any field: decimal, hexadecimal, binary, octal, or a base of your choice from 2 to 36. The other fields follow as you type.
- Prefixes are read where they belong, 0x in the hexadecimal field, 0b in binary and 0o in octal. Spaces and underscores between digits are ignored, so 1010 1010 and FF_FF work.
- Below the fields: the number of bits, the bytes in both byte orders, the Unicode character the number stands for, and how its bits read as an 8, 16, 32 or 64-bit value, signed and unsigned.
- Numbers of any size stay exact. A click on a value selects all of it, and the address bar follows the field you type in.
| 255 | FF in hexadecimal, 11111111 in binary, 377 in octal |
| 0x80070005 | 2147942405, or -2147024891 read as a signed 32-bit number, the form Windows error codes take |
| 0o755 | 493, the Unix permissions rwxr-xr-x |
| -1 | FF, FFFF and FFFFFFFF in two's complement at 8, 16 and 32 bits |
| 65 | U+0041, the letter A |
- Only whole numbers are converted. A fraction such as 0.1 has no exact binary form, and a converter that pretends otherwise rounds without saying so.
- In C and some older tools a leading zero means octal, so 0755 there is 493. The decimal field reads 0755 as 755; write it in the octal field, or as 0o755.
- A negative number keeps its minus sign in every base. The two's complement a computer stores it as is shown under Fixed widths.
- Hexadecimal and the larger bases are written in capitals. Lower case is read just as well.
Details
Fixed widths
The same bits read as an unsigned number and as a signed one in two's complement, at each width that holds them.