[Home](https://learningfolio.de5.net/) / [Math](https://learningfolio.de5.net/math/) / [Math glossary](https://learningfolio.de5.net/math/glossary/) / Binary Number System: Base 2, Conversion, and Examples

[Math glossary](https://learningfolio.de5.net/math/glossary/)

# Binary Number System: Base 2, Conversion, and Examples

Learn the binary number system, read base-two place values, convert integers and fractions, and check six worked examples.

Written by **Learningfolio Team**

We’re subject-matter experts in math, science, parent support, and education, with 100 years of combined experience. We believe in learning, experimenting, and growing, and we review one another’s work.

## On this page

* [TL;DR](https://learningfolio.de5.net/math/binary-number-system/#tldr)
* [Key Points](https://learningfolio.de5.net/math/binary-number-system/#key-points)
* [What is the binary number system?](https://learningfolio.de5.net/math/binary-number-system/#what-is-the-binary-number-system)
* [How do you read a binary number?](https://learningfolio.de5.net/math/binary-number-system/#how-do-you-read-a-binary-number)
* [How do you convert a decimal whole number to binary?](https://learningfolio.de5.net/math/binary-number-system/#how-do-you-convert-a-decimal-whole-number-to-binary)
* [How do binary numbers connect to octal and hexadecimal?](https://learningfolio.de5.net/math/binary-number-system/#how-do-binary-numbers-connect-to-octal-and-hexadecimal)
* [How does arithmetic work in the binary number system?](https://learningfolio.de5.net/math/binary-number-system/#how-does-arithmetic-work-in-the-binary-number-system)
* [Examples of Binary Number System](https://learningfolio.de5.net/math/binary-number-system/#examples-of-binary-number-system)
* [Where do binary conversions go wrong?](https://learningfolio.de5.net/math/binary-number-system/#where-do-binary-conversions-go-wrong)
* [Practice with answers](https://learningfolio.de5.net/math/binary-number-system/#practice-with-answers)
* [Frequently Asked Questions](https://learningfolio.de5.net/math/binary-number-system/#frequently-asked-questions)
* [What to Remember About Binary](https://learningfolio.de5.net/math/binary-number-system/#what-to-remember-about-binary)
* [Read More](https://learningfolio.de5.net/math/binary-number-system/#read-more)
* [Research Behind This Article](https://learningfolio.de5.net/math/binary-number-system/#research-behind-this-article)

## TL;DR

**The binary number system uses the digits 0 and 1, with each place worth a power of two.** For example, $1011_2=8+2+1=11_{10}$.

## Key Points

* The binary number system is base two, so moving one place to the left doubles the value attached to a digit.
* You can convert a whole decimal number to binary by dividing by two repeatedly and reading the remainders from last to first.
* Binary places to the right of the point represent halves, quarters and eighths, so $0.01_2$ equals one quarter.
* A bit pattern can represent different numbers under unsigned and signed conventions, making the width and encoding essential when you read it.

## What is the binary number system?

The **binary number system** represents numbers with two digits, 0 and 1. The rightmost whole-number place is worth one. Moving left gives places worth two, four, eight and sixteen. Harvard’s CS50 binary reference illustrates this place-value pattern by comparing base two with ordinary decimal notation.

Each binary digit is a **bit**. A bit of 1 includes its place value, while a bit of 0 leaves that place out. The same place-value idea works in decimal, where each move left multiplies a place’s value by ten.

![Binary number system diagram reading 1011 with place weights eight, four, two and one](https://learningfolio.de5.net/assets/versioned/binary-number-system-place-values.3dc3782e0540.webp)


The zero in the fours place contributes nothing. The ones in the other places contribute 8, 2 and 1.

## How do you read a binary number?

Start on the right with $2^0=1$. Calculate the successive powers of two to the left, multiply each place value by its bit, then add the products. A subscript marks the base, so $10_2$ means two while $10_{10}$ means ten.

For $n$ bits, let $b_i$ be the bit in the position numbered $i$ from the right, beginning at zero. Let $v$ be the decimal value of the unsigned bit pattern.

$$
v=\sum_{i=0}^{n-1}b_i\,2^i
$$

Leading zeros do not change the unsigned value. They still matter when a problem specifies a width. For instance, $0011_2$ has a value of 3 and occupies four bit positions.

| Decimal | Binary | Decimal | Binary |
| --- | --- | --- | --- |
| 0 | 0 | 8 | 1000 |
| 1 | 1 | 9 | 1001 |
| 2 | 10 | 10 | 1010 |
| 3 | 11 | 11 | 1011 |
| 4 | 100 | 12 | 1100 |
| 5 | 101 | 13 | 1101 |
| 6 | 110 | 14 | 1110 |
| 7 | 111 | 15 | 1111 |

### What do the binary places after the point mean?

Each step to the right halves the place value. The first three fractional positions are $2^{-1}$, $2^{-2}$ and $2^{-3}$. The University of Illinois’s notes on number representation derive these positions in its section on converting fractions.

$$
0.101_2=\frac12+\frac18=\frac58=0.625_{10}
$$

For a fraction strictly between zero and one, repeatedly multiply by two. Record each integer part and continue with the leftover fraction. For $0.625$, the successive integer parts are 1, 0 and 1, which gives $0.101_2$. A fraction in lowest terms has a terminating binary expansion exactly when its denominator is a power of two. For example, $\frac{1}{10}$ repeats in binary because the denominator contains a factor of five.

## How do you convert a decimal whole number to binary?

Divide the number by two repeatedly. At each step record the remainder, which is either 0 or 1. Stop when the quotient becomes zero and read your remainders in reverse order. NC State’s base conversion lesson illustrates the same procedure.

For a starting whole number $n$, division gives $n=2q+r$, where $q$ is the quotient and $r$ is the remainder. The remainder gives the ones-place bit. Dividing the quotient again reveals the next bit, which is why the method uncovers digits from right to left.

The powers-of-two method works as a check. Take the largest power of two that fits and subtract it. Move to smaller powers and write 1 for each power used and 0 for each unused position. When the value is zero, write $0_2$ directly.

## How do binary numbers connect to octal and hexadecimal?

Group bits in threes for octal and fours for hexadecimal. Swarthmore’s number representation notes connect the four-bit groups to hexadecimal because $16=2^4$. The parallel octal grouping uses $8=2^3$.

| Base | Digits available | Binary grouping |
| --- | --- | --- |
| Binary, base 2 | 0 and 1 | One bit per binary digit |
| Octal, base 8 | 0 through 7 | Three bits per digit |
| Decimal, base 10 | 0 through 9 | Convert by place values or repeated division |
| Hexadecimal, base 16 | 0 through 9, then A through F for 10 through 15 | Four bits per digit |

For a whole binary number, group from the right and pad a short group at the left with zeros. A binary fraction groups in the other direction after the point, so pad that side at the right. The added zeros preserve the value because they occupy unused places.

## How does arithmetic work in the binary number system?

Binary arithmetic uses the same place-value ideas as decimal arithmetic, with carries and borrows based on two. The University of Washington shows why adding $1_2+1_2$ writes a 0 in that column and carries 1 to the next column.

| Operation | What to do |
| --- | --- |
| Addition | Add the bits and any carry. A total of two writes 0 and carries 1. A total of three writes 1 and carries 1. |
| Subtraction | Borrow one from the place on the left when needed. It becomes two in the current column. |
| Multiplication | A partial product is zero or a shifted copy of the multiplicand. Add the partial products. |
| Division | Compare the shifted divisor with the remainder of the dividend. Each quotient bit records whether the divisor fits. |

For quick checks, $1010_2-0011_2=0111_2$, $101_2\times11_2=1111_2$, and $1100_2\div0011_2=0100_2$. Each result also checks in decimal: 10 minus 3 is 7, 5 times 3 is 15, and 12 divided by 3 is 4.

### What is the difference between unsigned and signed binary?

An $n$-bit unsigned value uses every place as a nonnegative power of two, covering zero through $2^n-1$. A common signed format, **two’s complement**, assigns the highest place the weight $-2^{n-1}$. The remaining bits keep their positive place values. The range runs from $-2^{n-1}$ to $2^{n-1}-1$.

Cornell’s two’s complement notes describe a convenient way to encode the negative counterpart of a representable positive integer: choose the width, flip every bit, then add one in that width. Flipping the bits alone gives the one’s complement. Keeping the width visible makes sense of otherwise ambiguous patterns such as $1010_2$, which reads as 10 unsigned or minus 6 in four-bit two’s complement.

## Examples of Binary Number System

These examples follow the bits from reading a short pattern to changing bases, adding, and interpreting a fixed-width signed value.

### Example 1

**Convert the binary number 1011 to decimal.**

1. Assign the place values 8, 4, 2 and 1 from left to right.
2. Multiply each by its bit, then add $8+0+2+1=11$.
3. The result is $11_{10}$.

### Example 2

**Convert the binary number 101.01 to decimal.**

1. Reading the fractional part as one hundredth gives $5.01$, which treats the right-hand places as powers of ten.
2. In base two, the bit after the point counts halves and the next counts quarters.
3. Add the whole and fractional values, $4+1+\frac14=5.25$.

### Example 3

**Write 29 in binary.**

1. Divide 29 by two to obtain quotient 14 and remainder 1.
2. Continue with quotients 7, 3, 1 and 0. The following remainders are 0, 1, 1 and 1.
3. Read the remainder sequence backwards to get $11101_2$. Check $16+8+4+1=29$.

### Example 4

**Add 1011 and 0110 in binary.**

1. From the right, the ones column gives 1.
2. The twos column adds 1 and 1, so write 0 and carry 1.
3. The fours column has 0, 1 and the carry, so write 0 and carry 1 again.
4. The eights column totals two, so write 0 and carry into the sixteens column. The result is $10001_2$.

### Example 5

**Convert 11010110 from binary to hexadecimal and octal.**

1. Four-bit groups give 1101 and 0110. These are 13 and 6, so the hexadecimal result is $\mathrm{D6}_{16}$.
2. Three-bit groups give 011, 010 and 110 after left-padding. These groups give $326_8$.
3. Both outputs equal $214_{10}$, which checks the grouping.

### Example 6

**Represent −6 in four-bit two’s complement.**

1. Write positive six in four positions as 0110.
2. Flip to 1001 and add one to get 1010.
3. Check using the signed weights. The first bit contributes −8 and the third contributes 2, so the total is $-8+2=-6$.

## Where do binary conversions go wrong?

The base, order and width each give information that the bare digits cannot carry by themselves.

### Mistake 1. Reading the remainders in the order you calculate them

**Where it slips in**

The first remainder feels like the first digit to write.

**The tempting calculation**

The generation order for 13 gives bits 1, 0, 1, 1, which would read as $1011_2=11$.

**The correction**

The first remainder belongs to the ones place at the far right. Read the sequence in reverse to get $1101_2=13$.

### Mistake 2. Dropping a carry without checking the width

**Where it slips in**

A learner sees four-bit operands and assumes the result also has to be four bits.

**The tempting calculation**

Writing 0001 for $1011_2+0110_2$ keeps the four low bits but loses the carry of 16.

**The correction**

For ordinary unsigned arithmetic, retain the carry and write 10001. In a deliberately fixed four-bit system, the stored result is 0001 with an unsigned carry out.

## Practice with answers

1. Convert $10010_2$ to decimal.
2. Write $37_{10}$ in binary.
3. Convert $1.011_2$ to a decimal fraction and decimal value.

### Check your solutions

1. The 1 bits contribute 16 and 2, so the value is 18.
2. Use $32+4+1=37$. The binary pattern is $100101_2$.
3. Add $1+\frac14+\frac18=\frac{11}{8}=1.375$.

## Frequently Asked Questions

### Why do digital computers use the binary number system?

Digital logic can distinguish two stable signal states. Engineers represent those states with bits, then use groups of bits to encode numbers, text, images and instructions. The interpretation depends on the encoding.

### Can a binary number contain 2?

The digit 2 does not appear inside a binary numeral. A subscript 2 can label its base. For example, the written numeral $100_2$ contains the digits 1, 0 and 0.

### How many unsigned values can eight bits represent?

Eight bits give $2^8=256$ patterns, covering 0 through 255 when interpreted as unsigned integers.

## What to Remember About Binary

* Each step left in a base-two numeral doubles the place weight.
* Read repeated-division remainders in reverse order to write a binary whole number.
* Use negative powers of two for positions after the binary point.
* Check the width and signedness before interpreting a stored bit pattern.

## Read More

* [How the Roman numeral system combines values](https://learningfolio.de5.net/math/roman-numerals/)

## Research Behind This Article

1. Harvard University CS50, *Binary*. [CS50 reference](https://cs50.harvard.edu/ap/2020/assets/pdfs/binary.pdf).
2. University of Illinois Urbana-Champaign, *Floating Point Representation, Number Systems and Bases*. [CS 357 notes](https://cs357.cs.illinois.edu/notes/ref-4-fp.html).
3. North Carolina State University, *Base Conversion Process*. [E 115 computing notes](https://e115.engr.ncsu.edu/hardware/binary/base-conversion-process/).
4. Swarthmore College, *Binary and Number Representation*. [Computer Systems course](https://www.cs.swarthmore.edu/~kwebb/cs31/s15/bucs/chapter01.html).
5. University of Washington, *Binary and Boolean Arithmetic*. [CSE reading](https://courses.cs.washington.edu/courses/cse390b/21sp/readings/binary_arithmetic.html).
6. Cornell University, *Two’s Complement*. [Computer Science notes](https://www.cs.cornell.edu/~tomf/notes/cps104/twoscomp.html).
