Binary Numbers Basics: How the Binary Number System Works
Learn what binary numbers are, how base-2 place values work, how to count in binary, and how to convert between binary and decimal with clear examples.
Binary numbers are numbers written with only two digits: 0 and 1. Computers use binary because electronic circuits can distinguish two stable logic states very reliably, while mathematics gives us a straightforward way to combine those states into numbers, text, images, instructions, and every other kind of digital data.
This guide focuses on the part that is most useful to understand: how the binary number system works, how binary place values are built, how to count in binary, and how to convert simple values between binary and decimal.
What Are Binary Numbers?
A binary number is a number expressed in base 2. Decimal is base 10, so each decimal position is a power of 10. Binary is base 2, so each binary position is a power of 2.
For example:
- Decimal
10means one ten and zero ones. - Binary
10means one two and zero ones, so it equals decimal2. - Binary
1010means8 + 2, so it equals decimal10.
A single binary digit is called a bit. Eight bits are commonly grouped into one byte, giving 256 possible 8-bit patterns from 00000000 through 11111111.
The Binary Number System
Binary uses positional notation just like decimal. The difference is the base.
In decimal, the positions from right to left are:
1, 10, 100, 1000, ...
In binary, they are:
1, 2, 4, 8, 16, 32, 64, 128, ...
Each position can contain only 0 or 1:
0means that place value is not included.1means that place value is included.
That simple rule is enough to represent any whole number.
Why Do Computers Use 0 and 1?
Digital circuits are built from components such as transistors. At the logic level, designers can treat two ranges of electrical conditions as two states. Those states are represented abstractly as 0 and 1.
Using two logic states gives circuits useful noise margins and keeps switching, storage, and logic operations practical. It is more accurate to think of 0 and 1 as logical states than as literal “no electricity” and “electricity.”
Once hardware can reliably store and process bits, combinations of bits can encode much more:
- numbers and arithmetic values
- text through character encodings
- image and audio samples
- machine instructions
- flags, permissions, and protocol fields
Binary Place Values
For an 8-bit number, the place values are:
| Bit position | Place value | Power of two |
|---|---|---|
| 7 | 128 | 2^7 |
| 6 | 64 | 2^6 |
| 5 | 32 | 2^5 |
| 4 | 16 | 2^4 |
| 3 | 8 | 2^3 |
| 2 | 4 | 2^2 |
| 1 | 2 | 2^1 |
| 0 | 1 | 2^0 |
Take binary 00101101 as an example:
0×128 + 0×64 + 1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1
The set positions are 32 + 8 + 4 + 1, so the value is 45 in decimal.
How Binary Numbers Work
A useful way to read a binary number is to scan from right to left and ask which powers of two are switched on.
For 101101:
| Binary digit | Place value | Contribution |
|---|---|---|
| 1 | 32 | 32 |
| 0 | 16 | 0 |
| 1 | 8 | 8 |
| 1 | 4 | 4 |
| 0 | 2 | 0 |
| 1 | 1 | 1 |
Add the contributions:
32 + 8 + 4 + 1 = 45
So binary 101101 equals decimal 45.
Counting in Binary: 0-15
Binary counting follows the same carry idea as decimal, but each position fills after 1 instead of after 9.
| Decimal | Binary |
|---|---|
| 0 | 0000 |
| 1 | 0001 |
| 2 | 0010 |
| 3 | 0011 |
| 4 | 0100 |
| 5 | 0101 |
| 6 | 0110 |
| 7 | 0111 |
| 8 | 1000 |
| 9 | 1001 |
| 10 | 1010 |
| 11 | 1011 |
| 12 | 1100 |
| 13 | 1101 |
| 14 | 1110 |
| 15 | 1111 |
The pattern becomes easier to recognize when you notice that each new power of two adds another position: decimal 1 is 1, 2 is 10, 4 is 100, 8 is 1000, and 16 is 10000.
Binary to Decimal Example
Convert binary 110101 to decimal by writing the place values underneath it:
1 1 0 1 0 1
32 16 8 4 2 1
Keep only the values under a 1:
32 + 16 + 4 + 1 = 53
Therefore:
110101₂ = 53₁₀
For longer values, use the Binary to Decimal converter.
Decimal to Binary Example
To convert decimal 42 to binary, decompose it into powers of two:
42 = 32 + 8 + 2
Now mark the 8-bit place values:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
So decimal 42 is binary 00101010 when shown as one byte.
Use Decimal to Binary to check larger numbers instantly.
Signed vs Unsigned Binary Numbers
A bit pattern does not inherently say whether it is signed or unsigned; the interpretation depends on the data type or protocol.
For an unsigned 8-bit integer, all eight bits contribute to magnitude, giving a range of 0 to 255.
For a typical signed 8-bit two’s-complement integer, the same 256 patterns represent values from -128 to 127. For example, 11111111 is unsigned 255, but interpreted as 8-bit two’s complement it represents -1.
That is why the surrounding type information matters when you read raw bytes. If you need to inspect signed representations, use the Two’s Complement Converter.
Binary Fractions
Binary can represent fractions too. Positions to the right of the binary point use negative powers of two:
| Position | Value |
|---|---|
2^-1 |
1/2 = 0.5 |
2^-2 |
1/4 = 0.25 |
2^-3 |
1/8 = 0.125 |
2^-4 |
1/16 = 0.0625 |
For example, binary 10.101 means:
2 + 1/2 + 1/8 = 2.625
Not every decimal fraction has a short finite binary representation, just as 1/3 repeats forever in decimal. That limitation is one reason floating-point values can show small rounding effects.
Binary Arithmetic: The Short Version
Binary arithmetic follows the same positional rules you already know from decimal, but carries and borrows happen at base 2.
The key addition cases are:
0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 10— write0and carry1
Subtraction, multiplication, and division use the same general ideas as decimal arithmetic. They are useful topics on their own, but this page keeps them at an overview level rather than splitting each operation into a separate SEO page.
Binary, Decimal, and Hex Together
Hexadecimal is often used as a compact way to write binary because every hex digit corresponds to exactly four bits. For example:
0010 1010 → 2A → decimal 42
Use Binary to Hex for direct conversion, or the Base Converter when you want to move among several number systems.
Summary
Binary numbers are ordinary positional numbers written in base 2. Once you understand the place values 1, 2, 4, 8, 16, 32, 64, 128..., reading and constructing small binary values becomes mechanical rather than mysterious.
The core ideas are:
- Binary uses only
0and1. - Each position is a power of two.
- Set bits contribute their place value to the total.
- The same bit pattern can mean different things depending on whether it is interpreted as unsigned, signed, text, or another data type.
- Hexadecimal is a compact companion notation because one hex digit maps to four binary bits.