Skip to content

Note · Fundamental concepts

How does binary work? Counting with 0s and 1s

Binary works like ordinary counting but with two digits instead of ten, so each place is worth twice the one to its right. How to convert numbers, add them, and read hexadecimal.

This note and the comments marked the Graphite mark are Graphite’s: an AI model, Claude Opus 5.5, wrote them on 5 November 2026, following Graphite’s own instructions, from the sources at the note’s end, and checked them against those sources. Check them as you would anyone’s.

This note and its comments are written by an AI model.

Contents · 7 sections

Binary is a way of writing numbers with only two digits, 0 and 1. It does the same job as ordinary decimal counting and works the same way, except that each place in a number is worth twice the place to its right instead of ten times: 1, 2, 4, 8, 16 and so on. That is how binary works: 1101 means one 8, one 4, no 2 and one 1, which is 13. Computers use binary because two states are easy to build and hard to confuse.

In short

  • In decimal each place is worth 10 times the one to its right; in binary, 2 times. That is the whole idea.
  • Any whole number can be written in binary, and converting it is a matter of finding which powers of 2 add up to it.
  • Hexadecimal, base 16, is shorthand for binary: each hex digit stands for exactly four binary digits.

What does place value mean?

Start with the system you already use. In the decimal number 365, the 3 doesn't mean three; it means three hundreds. Each place is worth ten times the place to its right, so 365 is 3 × 100 + 6 × 10 + 5 × 1. Decimal uses ten digits, 0 to 9, because a place can hold up to nine before it rolls over into the next place, the way an odometer goes from 9 to 10.

Binary keeps the idea and changes the number. Each place is worth two times the place to its right, so the places, from the right, are worth 1, 2, 4, 8, 16, 32, 64, 128 and onward, the powers of 2. With only two digits, a place rolls over after 1: counting goes 0, 1, 10, 11, 100, 101, 110, 111, 1000. Binary 10 is two, binary 100 is four, and binary 1000 is eight. To avoid confusion, binary numbers are often written with a subscript, 1101₂, or a prefix, 0b1101.

Nothing about numbers themselves is decimal or binary. Thirteen is the same quantity however it is written; base 10 and base 2 are two ways of writing it down, the way the note on what a number is separates a quantity from its symbols. Each binary digit is called a bit, and eight of them make a byte, which bits vs bytes takes further.

How do you convert a decimal number to binary?

One way is to subtract the largest power of 2 that fits, again and again. The other, which always works and is easy to do on paper, is to divide by 2 repeatedly and keep the remainders. It is a small algorithm: exact steps that are guaranteed to stop.

13 to binary. Divide by 2 and write down each remainder:

Step Division Result Remainder
1 13 ÷ 2 6 1
2 6 ÷ 2 3 0
3 3 ÷ 2 1 1
4 1 ÷ 2 0 1

Read the remainders from the bottom up: 1101. The first remainder is the 1s digit, the next the 2s digit, and so on, which is why they are read in reverse.

200 to binary. The same steps give remainders 0, 0, 0, 1, 0, 0, 1, 1. Read from the bottom up, that is 11001000.

To check, or to go back the other way, add up the place values wherever there is a 1:

Place value 128 64 32 16 8 4 2 1 Total
13 0 0 0 0 1 1 0 1 8 + 4 + 1 = 13
200 1 1 0 0 1 0 0 0 128 + 64 + 8 = 200

With 8 bits, the largest number is 11111111, which is 255: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1. Every extra bit doubles how many values can be written. Eight bits give 256 values, 0 to 255; 32 bits give over 4 billion, which is why an old-style IP address, 32 bits long, tops out at 4,294,967,295.

How do you add in binary?

Exactly as in decimal, column by column from the right, carrying when a column overflows. The only facts to know: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1), and 1 + 1 + 1 = 11 (write 1, carry 1).

Add 13 and 7, which is 1101 + 0111:

  1. 1s column: 1 + 1 = 10. Write 0, carry 1.
  2. 2s column: 0 + 1, plus the carry 1, = 10. Write 0, carry 1.
  3. 4s column: 1 + 1, plus the carry 1, = 11. Write 1, carry 1.
  4. 8s column: 1 + 0, plus the carry 1, = 10. Write 0, carry 1.
  5. 16s column: only the carry: write 1.

The answer is 10100: one 16 and one 4, which is 20. Inside a computer, this column-by-column rule is built out of logic gates, and the note on how computers work shows the two gates that add a single column.

What is hexadecimal, and why do programmers use it?

Long strings of 0s and 1s are hard for people to read, so programmers often write binary in hexadecimal, base 16. Hexadecimal needs sixteen digits, so after 0 to 9 it uses the letters A to F for ten to fifteen. Because 16 is 2 × 2 × 2 × 2, one hex digit stands for exactly four bits, and converting is just grouping:

Binary 1100 1000
Hex digit C (twelve) 8

So 200, binary 11001000, is hex C8, and 255, binary 11111111, is FF. One byte is always exactly two hex digits. This is why web colors are written like #FF8800: three bytes, for the amounts of red, green and blue, each from 00 to FF. It is also how character codes are written, as the note on ASCII shows: the letter A is 65, or hex 41.

Why do computers use binary?

Because a switch with two states is cheap, fast and reliable, and a switch with ten is not. A computer stores and moves bits as physical states, such as a voltage that is high or low, a tiny charge that is present or absent, or a spot on a disk magnetized one way or the other. Real signals are noisy: voltages drift with heat and interference. If a circuit only has to tell "high" from "low", there is a wide safety margin between them, and a little noise changes nothing. If it had to tell ten levels apart, each would sit close to its neighbors, and small errors would turn one digit into another.

Binary also matches logic. In his master's thesis at MIT, written in 1937, Claude Shannon showed that circuits of switches could carry out George Boole's algebra of true and false, and so could do arithmetic (Wikipedia). True and false map onto 1 and 0, and the same circuits that make logical decisions add numbers.

The simple picture has exceptions. Some early machines, including the ENIAC of 1945, worked in decimal internally. Today, many flash memory chips store more than one bit per cell by holding one of 4, 8 or 16 charge levels, trading some reliability for density, then use error-correcting codes to catch mistakes. But all of them still present their data to the rest of the computer as bits.

Where did binary come from?

The idea of building numbers from two symbols is old. The Indian scholar Pingala, around the 2nd century BC, described poetic meters as patterns of short and long syllables in a way that matches binary counting, and the hexagrams of the Chinese I Ching, patterns of broken and unbroken lines, can be read the same way.

The modern system is usually credited to the German philosopher and mathematician Gottfried Wilhelm Leibniz. His article Explication de l'Arithmétique Binaire, published in 1703, set out binary arithmetic using only 1 and 0. In 1700 and 1701 he had corresponded with the Jesuit missionary Joachim Bouvet, who pointed out that the I Ching hexagrams could be read as binary numbers, and the full title of Leibniz's article mentions the "ancient Chinese figures of Fu Xi" (Wikipedia). Leibniz also saw religious meaning in it: everything built from one and nothing. It took another two centuries, and electric switches, for binary to become practical.

Check yourself

  • Without looking back, convert 25 to binary by repeated division, then check it by adding place values.
  • Why does each extra bit double the number of values that can be written?
  • Why is it easier to build reliable circuits with two states than with ten?

Sources

Published by Graphite on , set the way Graphite publishes a note.

This note and the comments marked the Graphite mark are Graphite’s: an AI model, Claude Opus 5.5, wrote them on 5 November 2026, following Graphite’s own instructions, from the sources at the note’s end, and checked them against those sources. Check them as you would anyone’s.

About the author

Graphite

An AI model, Claude Opus 5.5, wrote it for Graphite from the sources at its end.

More in Fundamental conceptsSearch the MarketplaceWho writes here