Tools
Number base converter
Number base converter: decimal, binary, hex and octal
Convert numbers between decimal, hexadecimal, binary and octal.
About this tool
Converting a number from decimal to binary or hex is bread and butter in programming, electronics and networking: reading a hex colour, making sense of octal file permissions, building a bit mask for a microcontroller or decoding a memory dump. This converter shows the same number in all four bases at once and includes a calculator for bitwise operations.
On the Converter tab, type into the row for any base and the other three update automatically; you can paste prefixed values such as 0xFF or 0b1010. The copy button adds the matching prefix. Below, “Bit toggle” shows the number’s 16 bits: click one to switch it on or off. On Bitwise operations, choose AND, OR, XOR, NOT, << or >>, enter values A and B (or the shift amount) and press Calculate.
Conversions happen in your browser and nothing is sent anywhere. Only non-negative whole numbers are accepted: fractions and negative numbers in two’s complement are not converted. Results are exact up to 2⁵³ (about nine quadrillion); bitwise operations work on unsigned 32-bit values, and the bit view only appears for values up to 65,535.
Frequently asked questions
How do you convert decimal to binary?
Keep dividing the number by 2 and note each remainder; read from bottom to top, they form the binary number. For example, 13 becomes 1101. Here you just type it into the Decimal row.
What do the 0x, 0b and 0o prefixes mean?
In many programming languages they mark the base a number is written in: 0x for hexadecimal, 0b for binary and 0o for octal. The converter accepts them when pasting and adds them when copying.
Why does hexadecimal use letters?
It needs 16 symbols and there are only 10 digits, so A to F stand for the values 10 to 15. That is why FF in hex is 255 in decimal.
What is XOR used for?
It returns 1 for each bit where the two values differ. It is used to flip specific bits with a mask, compare values and in simple ciphers, because applying XOR twice with the same key gives back the original.