What is binary?
Every photo, song and text message on your computer is stored as a long string of 1s and 0s. Binary is the counting system that uses only those two digits, which is why people also call it base 2.
Computers use two digits because the hardware stores each value as something that is either on or off. A transistor is a tiny switch that either lets electric current through or blocks it, so it can stand for a 1 or a 0. A modern chip wires billions of these switches together to store and work with every kind of data.
The everyday decimal numbers we use have places worth 1, 10, 100 and so on, with each place worth 10 times the one to its right. Binary places double instead, so they go 1, 2, 4, 8 and up. The binary number 1101 means one 8, one 4, no 2 and one 1, which adds up to 13.
decimal binary
0 0
1 1
2 10
3 11
4 100
5 101
13 1101
Each binary digit is called a bit and eight bits make a byte, which can hold 256 different values from 0 to 255. Kilobytes, megabytes and gigabytes are bigger counts of bytes.
Computers turn text into binary by giving every character a number. ASCII and Unicode are the standard tables that match characters to numbers. The letter A is 65 in both, which is 01000001 as a byte.
Long rows of 1s and 0s are hard for people to read, so developers usually write binary in hexadecimal instead. Hexadecimal squeezes every byte into two characters, so 11111111 becomes ff. It’s the format behind CSS colors like #ff0000 and the long strings of letters and numbers you see in a hash.
Developers also say “binary” to describe files like images, audio and the apps you install, since they aren’t meant to be read as text. Every file is stored as bits underneath. A text file’s bytes all line up with readable characters while a binary file’s bytes don’t. Opening a photo in a text editor fills the screen with garbage symbols for this reason.