Guides Binary fundamentals

The Binary Number System Explained

Binary is not a separate kind of math; it is counting with only two symbols. Once you internalize powers of two and the rhythm of carries, you can read small bit patterns at a glance and debug the larger ones with reliable algorithms instead of memorizing magic strings.

What base-2 means

In decimal, each column is ten times the previous. In binary (base-2), each column doubles. You only ever write 0 or 1 in a column. When you would reach “two,” you reset the ones column to 0 and carry a 1 into the twos column, exactly like reaching ten in decimal resets the ones column and increments the tens column.

Hardware loves binary because two stable states are easier to engineer reliably than ten distinct voltage levels. Software inherits that representation, which is why file sizes, color depths, and network flags all speak in bits and bytes.

Powers of two

Memorizing the first several powers of two accelerates mental conversion. The sequence begins 1, 2, 4, 8, 16, 32, 64, 128 for the exponents 0 through 7. Those eight values are the place weights for an eight-bit byte read from right to left.

When you recognize 64 + 16 + 8 as 88 in decimal instantly, you spend less time rewriting the same arithmetic on scratch paper during exams or code reviews.

Counting from 0 to 15

Four bits encode sixteen distinct values. The following table is worth copying into notes until it feels familiar.

Decimal Binary
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
101010
111011
121100
131101
141110
151111

Converting decimal to binary (division method)

For a nonnegative integer, repeatedly divide by two and record remainders. The binary representation is the sequence of remainders read from bottom to top. For example, decimal 13 divides to remainder 1, then 6 with remainder 0, then 3 with remainder 0, then 1 with remainder 1, then 0 with remainder 1. Reading upward yields 1101.

This method scales to larger numbers because you do not need the table memorized in advance; you only need patience and careful bookkeeping.

Converting binary to decimal (positional method)

Write place values under each bit, starting at 1 on the right and doubling leftward. Add the weights where the bit is 1. For 10110, weights are 16, 8, 4, 2, 1. Bits on at 16, 4, and 2 sum to 22 in decimal.

Leading zeros do not change the value, but they do change width, which matters when you interpret memory or fixed-size registers.

Binary addition (with carry)

Add bits column by column from right to left. 0+0 is 0; 1+0 or 0+1 is 1; 1+1 is 0 with carry 1. If a carry enters a column, treat it like adding an extra 1 in that column.

Example: 1011 + 1101 yields 11000 (decimal 11 + 13 = 24). Tracing carries by hand once cements the pattern for bitwise logic later.

If you add two eight-bit values and the ninth carry would be needed, hardware reports overflow in fixed-width arithmetic. Unsigned addition wraps modulo 256 for bytes; signed addition uses the same bit pattern but interprets the top bit differently. That is why languages ask you to choose signed versus unsigned types when bit patterns could be ambiguous.

Practice problems

Attempt these without a calculator first. Expand each answer to check your work.

Decimal → binary: convert 19

Answer: 10011

Decimal → binary: convert 27

Answer: 11011

Decimal → binary: convert 32

Answer: 100000

Decimal → binary: convert 45

Answer: 101101

Decimal → binary: convert 63

Answer: 111111

Binary → decimal: convert 1010

Answer: 10

Binary → decimal: convert 110011

Answer: 51

Binary → decimal: convert 100001

Answer: 33

Binary → decimal: convert 111100

Answer: 60

Binary → decimal: convert 101010

Answer: 42

Tips for learning binary faster

Drill nibbles (four-bit groups) until hex feels automatic. Chunking 1100 1010 as two hex digits is faster than thirteen individual bits in isolation. Practice translating your age, the day of the month, and small constants you see in code.

Explain carries aloud while adding. Pair pencil work with verification through a trusted converter so mistakes become patterns you recognize next time.

When documentation shows values like 0b1111_0000, the underscores are only visual separators; they do not change the numeric value. Likewise, leading zeros pad a value to a byte, word, or register width so comparisons line up in simulators and test benches. Reading dumps becomes easier when you mentally align columns and annotate powers of two along the top row of scratch paper.

Frequently asked questions

How high can you count with 8 bits?

Unsigned, you can represent 256 values from 0 through 255. Signed two's complement on eight bits typically spans −128 through 127.

What is binary addition?

Column-wise addition with carries, identical in spirit to base-10 addition but with only digits 0 and 1.

How do negative numbers work in binary?

Common systems use two's complement inside a fixed bit width. The details depend on whether you treat a pattern as signed or unsigned.

Related guides

Related tools