What is binary code?
Beginner · 6 min read · Updated 28 November 2026
In shortBinary code is a way of representing information with just two symbols, 0 and 1. Each 0 or 1 is a bit; computers group bits into bytes (8 bits) to store numbers, letters, pictures and sound, because electronic circuits can reliably tell two states apart — off and on.
Binary in one sentence
Binary is a base-2 number system: instead of ten digits (0–9) it uses two (0 and 1), and each place to the left is worth twice as much as the one before — 1, 2, 4, 8, 16 and so on.
Why computers use 0s and 1s
Inside a chip, billions of transistors act as tiny switches. A switch is either off (0) or on (1). Two states are easy to detect even when the signal is a bit noisy, which makes binary fast and reliable. Everything else — numbers, words, photos, music — is built on top of those two states.
Bits and bytes
- A bit (binary digit) is a single 0 or 1.
- A byte is 8 bits, enough for 256 different values (0–255).
- Your phone’s storage is measured in gigabytes — billions of bytes.
See bits, bytes and nibbles for the full ladder from bits to terabytes.
How binary represents different kinds of data
| Data | How it becomes binary | Example |
|---|---|---|
| Whole numbers | Written in base 2 | 13 → 1101 |
| Text | Each character has a code number (ASCII / UTF-8) | A → 65 → 01000001 |
| Colours | Red, green and blue levels, one byte each | orange → 11111111 10001000 00000000 |
| Images | A grid of pixels, each a colour | a 12-megapixel photo ≈ 36 million bytes before compression |
| Sound | The wave’s height measured thousands of times a second | CD audio: 44,100 samples per second |
A quick example
The word Hi in binary is 01001000 01101001. The first byte is 72 (H), the second is 105 (i). Try it yourself in the binary translator.
Binary vs binary code vs machine code
People use “binary” loosely. Strictly:
- Binary numbers are just numbers written in base 2.
- Binary code is any scheme that maps data onto bits — ASCII, UTF-8, Morse-like codes, barcodes.
- Machine code is binary that a processor executes as instructions.
Frequently asked questions
Who invented binary code?
Gottfried Wilhelm Leibniz described the modern binary number system in 1703. George Boole’s algebra of true/false logic (1854) and Claude Shannon’s 1937 work linking it to electrical switches made it the basis of digital computers.
Why do computers use binary instead of decimal?
A transistor only needs to be clearly “on” or “off”. Distinguishing ten voltage levels would be far less reliable, slower and more expensive, so two states win.
Is binary code a language?
Not exactly. Binary is a number system. Codes like ASCII and UTF-8 are agreements about what each binary number means, and machine code is a set of binary instructions a particular processor understands.