How to use it
- 1.For numbers, stay on “Number bases” and type into any field: decimal, binary, octal or hexadecimal. The other three update instantly.
- 2.Prefixes such as
0b,0oand0x, a minus sign, and spaces or underscores between digits are all fine. Choose whether to group binary digits in fours (nibbles) or eights (bytes). - 3.For text, switch to “Text ↔ binary” and type a message to get its UTF-8 bytes in binary, hex or decimal.
- 4.To read binary code, choose the opposite direction and paste the bytes, with or without spaces. Swap flips the direction and keeps the result.
How binary numbers work
Binary is base 2: each digit, called a bit, is 0 or 1, and each position is worth twice the one to its right (1, 2, 4, 8, 16 and so on). So 1011 is 8 + 0 + 2 + 1 = 11. Decimal works the same way with powers of 10, octal with powers of 8, and hexadecimal with powers of 16, using the letters A–F for the values 10 to 15.
Programmers like hexadecimal because one hex digit is exactly four bits: F is 1111, so the byte 1111 0000 is simply F0. Octal digits stand for three bits each and live on mainly in Unix file permissions such as 755.
The converter uses arbitrary-precision integers, so it isn’t limited to 32 or 64 bits; numbers with thousands of digits work too. Negative numbers get a minus sign, and below the fields you also see their two’s complement, the form in which computers actually store them.
How text becomes binary
Computers store text as numbers. Unicode gives every character a number, its code point (A is 65, é is 233, € is 8364), and UTF-8 writes that number as one to four bytes. English letters and digits take one byte each, accented letters two, most other scripts three, and emoji four.
So “Hi” becomes 01001000 01101001: the byte 72 for H and 105 for i. Because the tool uses UTF-8, the encoding of the web, the bytes you get match what programs and websites really send.
Reading binary code
Binary messages are usually written as groups of eight bits, one group per byte. If the groups have only seven bits, because another converter dropped the leading zero, the tool still reads them as long as spaces separate the bytes. Without spaces, the total has to be a multiple of eight bits; otherwise there’s no way to tell where one byte ends and the next begins.
If the bytes don’t form valid UTF-8, the characters that can’t be decoded appear as �. That usually means the data isn’t text at all, or it was saved in an older character set such as Windows-1252.
Questions and answers
How do I convert binary to decimal?
Multiply each bit by its place value and add up the results. For 101101 that’s 32 + 8 + 4 + 1 = 45. Or type the binary number into the Binary field above and read the decimal value straight away.
How do I write my name in binary?
Open “Text ↔ binary” and type your name. Each letter becomes one 8-bit byte: A is 01000001 and a is 01100001, for example. Accented letters and characters from other alphabets take two or more bytes.
What is the difference between a bit and a byte?
A bit is a single binary digit, 0 or 1. A byte is a group of eight bits and can hold 256 different values, from 0 to 255 (00000000 to 11111111). File sizes are counted in bytes, while internet speeds are usually given in bits per second.
How are negative numbers stored in binary?
Almost all computers use two’s complement: to get −x, flip every bit of x and add 1. In 8 bits, −1 is 11111111 and −128 is 10000000. The converter shows the two’s complement of any negative number in the smallest common width: 8, 16, 32 or 64 bits.
Why do programmers use hexadecimal instead of binary?
It’s far shorter and converts to binary directly, because every hex digit stands for exactly four bits. A 32-bit value needs 32 binary digits but only 8 hex digits, which is why memory addresses, colour codes such as #FF8800 and hashes are written in hex.