What Is Binary Code?
Updated · UTF-8 text encoding
Binary code is information written with just two symbols, 0 and 1. Everything a computer stores, from this sentence to a song or a photo, is a long run of these binary digits, called bits.
Why computers use binary
A computer chip is made of billions of tiny switches called transistors. Each switch is either off or on, and it's much easier to build reliable hardware that tells two states apart than ten. So computers count in base 2 instead of base 10: off is 0, on is 1.
What is binary code and how does it work?
In our everyday decimal numbers, each place is worth ten times the one to its right: ones, tens, hundreds. In binary, each place is worth twice as much: 1, 2, 4, 8, 16, 32, 64, 128. To find the value, add the places that hold a 1. So 1101 is 8 + 4 + 1 = 13.
Bits are grouped into bytes of eight. One byte has 256 possible patterns, from 00000000 to 11111111 (0 to 255). That range is shown in full on the binary numbers chart.
How binary code stores letters
To store text, every character is given a number, and the number is saved in binary. The original table for English, ASCII, gave capital A the number 65, so A is stored as 01000001. Today's computers use Unicode, which keeps those same codes for English and adds numbers for every other writing system and emoji, stored as 1 to 4 bytes using UTF-8. See every letter on the binary alphabet chart.
How to read binary code by hand
- Split the code into bytes of 8 digits.
- Under each byte, write the place values 128, 64, 32, 16, 8, 4, 2, 1.
- Add the place values under every 1 to get a number.
- If it's text, look up the number: 65 to 90 are A to Z, 97 to 122 are a to z, and 32 is a space.
01000010 01111001 01100101 works out to 66, 121, 101, which spells "Bye". The binary translator does this in one step.
Binary code beyond text
- Images: each pixel's color is usually three bytes, one each for red, green and blue.
- Sound: a recording is a long list of numbers measuring the sound wave thousands of times a second.
- Programs: the instructions a processor runs are themselves binary codes, usually shown to people in hex to keep them short (see binary to hex).
The same bits can mean different things depending on how a program reads them. 01000001 is the letter A as text, the number 65 as a whole number, and a fairly dark blue as one color channel.
Questions people ask
What is binary code in simple terms?
Information written with only 0 and 1. Computer circuits have two states, so groups of bits stand for numbers, letters and instructions.
How do you read binary code?
Split into bytes, add the place values under each 1, and look the value up in ASCII: 01000010 = 66 = B. Or paste it into the binary to text converter.
What is a bit and a byte?
A bit is one 0 or 1. A byte is 8 bits, which gives 256 values: enough for one English letter.
Is binary code the same as Morse code?
No. Morse uses dots, dashes and pauses with letters of different lengths; binary uses fixed groups of 0s and 1s.