Number Base Converter
Convert an integer of any size between binary, octal, decimal, hexadecimal and any base from 2 to 36, with its two's-complement forms.
| Width | Hex | Binary | Read as signed | Read as unsigned |
|---|---|---|---|---|
| 8-bit | ||||
| 16-bit | ||||
| 32-bit | ||||
| 64-bit |
Pin tools here. They are saved in this browser.
Pin a tool and its sticker lands here.
Convert an integer of any size between binary, octal, decimal, hexadecimal and any base from 2 to 36, with its two's-complement forms.
| Width | Hex | Binary | Read as signed | Read as unsigned |
|---|---|---|---|---|
| 8-bit | ||||
| 16-bit | ||||
| 32-bit | ||||
| 64-bit |
A base, or radix, is the number of distinct digits a positional notation uses. Decimal has ten, binary has two, octal has eight and hexadecimal has sixteen, borrowing a to f for the values ten to fifteen. Bases up to 36 continue through the alphabet to z.
Binary is how hardware stores numbers. Hexadecimal is its compact spelling, since one hex digit is exactly four bits and two are one byte. Octal is still used for Unix file permissions, where each digit is three bits.
Every field on this page shows the same integer. Edit any of them and the others follow.
Digits may be separated by spaces or underscores, as in 1111_0000 or 1 000 000, and the number may start with a minus sign. The prefixes 0b, 0o and 0x select binary, octal and hexadecimal wherever the letter is not itself a digit of the field: 0xff typed in the decimal field is read as 255, while 0b1 in the hexadecimal field is the hex number B1.
The conversion uses JavaScript's BigInt, an arbitrary-precision integer type, so nothing is rounded. The only size limit is the one the browser's JavaScript engine places on a BigInt, and a number that exceeds it is reported in its field. Numbers above 9,007,199,254,740,991, where ordinary JavaScript numbers start to lose precision, convert exactly. Only integers are supported, not fractions.
The fields show a negative number as a minus sign followed by its magnitude. Computers store it differently: in two's complement, a negative value is stored as that value plus two to the power of the width. In 8 bits that power is 256, so -1 is stored as 255, which is ff, and -128 as 128, which is 80.
The table shows the bit pattern for 8, 16, 32 and 64 bits whenever the value fits, and what that pattern means when it is read back as a signed and as an unsigned integer. That is why 255 and -1 share the pattern ff in 8 bits.
Each binary digit is worth a power of two, starting from 1 at the right. Add the powers where the digit is 1: 1011 is 8 + 2 + 1, which is 11.
One hexadecimal digit represents exactly four bits, so a byte is always two hex digits. That makes memory dumps, colours, hashes and bit masks far shorter than binary and still easy to map back to bits.
The tool sets no limit of its own. It uses arbitrary-precision integers, so numbers with thousands of digits convert exactly. Very long inputs take longer to compute, and each browser's JavaScript engine has a maximum size for one integer. A number above that size is reported in its field.
It is the way almost all computers store signed integers. The highest bit carries a negative weight, so an 8-bit value ranges from -128 to 127 and -1 is stored as eight 1 bits.
It opens in its own window and keeps working offline.
To install it, tap the Share button, then “Add to Home Screen”.