Skip to main content

Binary Byte Simulator

Flip eight bits by hand and watch the number change, the way the wooden demonstrators in computing museums do it. Then switch modes and the same tiles become a chmod permission set and a subnet mask, so 755 and /26 stop being things to memorise. Count upward to watch a carry travel along the bits.

Category: Fundamentals

What You Will Learn

  • How binary works: each bit is a place value, and the number is the lit places added up
  • Why a byte holds 0 to 255, and why colour channels and IPv4 octets stop at 255 too
  • How a carry ripples along the bits when you count upward
  • How chmod numbers work: why 755 and 644 mean what they mean, and how they map to rwxr-xr-x
  • Why an SSH private key needs 600, and why 777 is almost never the right answer
  • How a subnet mask is built from bits, why it must be a solid run of 1s, and where /24 and /26 come from
  • Why shifting bits left doubles a number until the top bit falls off the end

Topics covered: binary, bits, chmod, permissions, subnet, cidr, networking, linux, fundamentals

// simulator

Binary Byte Simulator

Flip eight bits by hand and watch the number change, the way the wooden demonstrators in computing museums do it. Then switch modes and the same tiles become a chmod permission set and a subnet mask, so 755 and /26 stop being things to memorise. Count upward to watch a carry travel along the bits.

Supported bySvixDigitalOceanDevDojoSMTPfastQuizAPIBecome a sponsor

Binary · one bit at a time

Flip the bits, watch the value

Eight tiles, each one a bit. Click one to flip it, or press Space on a focused tile. The same tiles become a byte, a set of file permissions, and a subnet mask.

0decimal
as maths0

Press Count up and watch the carry travel. A tile can only show 0 or 1, so when it is already 1 and has to grow, it flips back to 0 and pushes the carry to its neighbour. That is the whole of binary arithmetic.

ChallengeMake 42

About this binary simulator

What you'll learn

  • What a bit and a byte actually are, by flipping them yourself
  • How to read any binary number without doing arithmetic in your head
  • Where chmod numbers come from, and how to build one from scratch
  • How a subnet mask is really just a run of 1s, and what the slash number counts
  • Why counting in binary makes a carry travel along the bits
  • What a bit shift does to a value, and why it is used as fast multiply and divide

The three modes

  • Byte: eight bits, with the decimal, hex and the sum of place values updating as you flip
  • Permissions: nine bits as owner, group and other, showing the octal, the ls -l string, and the chmod command
  • Subnet mask: thirty-two bits in four octets, showing the dotted mask, the prefix length and the usable host count

Start with Count up

The single most useful thing on the page is the Count up button. A tile can only ever show 0 or 1, so when a tile that is already 1 has to grow, it flips back to 0 and pushes a carry to its neighbour. Watch that carry travel from the right hand side, and every later idea in binary gets easier: why 8 is written as a single lit bit, why 7 fills every bit below it, and why adding 1 to 255 wraps a byte back to 0.

Why permissions are three groups of three

A permission set is nine bits: read, write and execute, for the owner, the group, then everyone else. Three bits hold a value from 0 to 7, which is exactly one octal digit, and that is the whole reason chmod numbers are written in octal rather than decimal. Build 755 in the simulator and the pattern stops being something to memorise: the owner has all three bits lit, and the other two groups have read and execute but not write.

Why a subnet mask cannot have gaps

A mask splits an address into a network part and a host part, and the split has to happen at one point, so the 1s must run solidly from the left. Try flipping a bit in the middle of the run: the simulator will tell you the mask is invalid, which is the same thing your router would say. That rule is why a mask can be written as a single number, /24, instead of a pattern, and why borrowing one more bit halves the address space each time.

Where this comes from

Computing museums keep hand-built wooden versions of this: eight tiles on a rail, each flipped by hand, sitting next to the valve machines they explain. They work because binary stops feeling abstract the moment it is a physical thing you can move with your thumb. This is that device, with the parts an engineer actually meets bolted on.

Keep going

Once the bits make sense, the Linux terminal simulator puts chmod to work on a real file tree, and the AWS VPC simulator uses subnet masks to carve up a network.

Try next

Sponsored
Carbon Ads
$ cd /games
// share