Binary

Base 2 — just two digits, and everything a computer thinks it knows. A plain-English guide to number systems from TorchAnvil.

Binary is base 2 — just two digits, 0 and 1. That's it. Every number, every colour, every sound a computer stores eventually bottoms out as a long row of those two symbols. Once you can read a handful of bits at a glance, a huge amount of digital hardware stops feeling mysterious.

Why computers love binary

A circuit is much happier with "on" and "off" than with "a little bit on" or "sort of halfway." A wire either has voltage or it doesn't. A redstone torch is either lit or dark. A capacitor is either charged or drained. These are two-state devices, and two-state devices map perfectly onto two-digit numbers.

The payoff is reliability. If a signal drifts a bit — say, a voltage sags from five volts to four — the circuit still reads it as "on," because "on" is any voltage above some threshold. Binary gives you a healthy gap between the two states, and that gap is what lets tiny, fast, cheap transistors work without constantly making mistakes.

How to count in binary

Each column in a binary number is a power of two, starting from 1 on the right and doubling as you go left: 1, 2, 4, 8, 16, 32, and so on. To count up, you flip bits the same way you do in decimal — the rightmost digit rolls over first, and a rollover carries one into the column to its left.

Here are the first sixteen numbers in four-bit binary:

Decimal Binary Decimal Binary
0 0000 8 1000
1 0001 9 1001
2 0010 10 1010
3 0011 11 1011
4 0100 12 1100
5 0101 13 1101
6 0110 14 1110
7 0111 15 1111

Four bits cover 0 through 15 — sixteen values total. Add a fifth bit and you get thirty-two. Each extra bit doubles the range.

Reading a binary number

Take 1011. Line the bits up against their column values, starting from the right:

Bit 1 0 1 1
Column value 8 4 2 1

Add up the columns where the bit is 1: 8 + 0 + 2 + 1 = 11. So 1011 in binary is 11 in decimal.

Try another: 1100 is 8 + 4 = 12. And 0001 is just 1. The trick never changes — find the 1s, add their column values, done.

The rightmost bit is called the least significant bit (it carries the smallest weight), and the leftmost is the most significant bit. You'll see those names on data sheets and in code.

In Minecraft redstone

Every redstone wire is already binary. A signal is either flowing or it isn't — "on" and "off" are your 1 and 0. A line of torches, a row of lamps, or the outputs of a counter are a string of bits you can read straight off the world.

That's why the four-bit adder and four-bit counter in the library each use four separate redstone lines. Four lines, four bits, sixteen possible states. A clock ticks the counter through them in order, and a display turns the bits into something your eyes can parse faster than 1011.

Try it

Open the Base Converter and type a decimal number. Watch the binary column roll over as you step up by one. Once you've seen 15 become 1111 and then 16 become 10000, the pattern sticks for good.