MODERN · BASE 2

Binary

Two digits, 0 and 1, count powers of two. Decimal 42 becomes 101010 in binary.

Convert numbers
Place
Worldwide · digital computing
Period / variant
Modern computing; earlier mathematical roots
EXAMPLES

42 · Base 2

101010: 32 + 8 + 2 = 42.

Worked example

Write 42 in Binary

Read from left to right. The rightmost place counts ones; each place to its left is worth 2 times as much.

  1. 42 ÷ 32 = 1, remainder 10. Start with 1 in the 32s place, then write the remainder in the lower places.

  2. This sign is the digit 1. In the 32s place, it contributes 1 × 32 = 32.

  3. This sign is the digit 0. Keep zero in the 16s place; this position contributes nothing.

  4. 10 ÷ 8 = 1, remainder 2. This sign is the digit 1. In the 8s place, it contributes 1 × 8 = 8.

  5. This sign is the digit 0. Keep zero in the 4s place; this position contributes nothing.

  6. 2 ÷ 2 = 1, remainder 0. This sign is the digit 1. In the 2s place, it contributes 1 × 2 = 2.

  7. This sign is the digit 0. Keep zero in the ones place; this position contributes nothing.

Check

1 × 32 + 0 × 16 + 1 × 8 + 0 × 4 + 1 × 2 + 0 = 42

Sources and notation notes

NASA Space Place — How do we talk to machines? · Leibniz — Explanation of Binary Arithmetic (1703), translated in Leibniz on Binary

Meet the symbols

Each tile shows one digit and its value. These are the 2 digits used by this display. Combine them using the rules below.

  • 0
  • 1

How the symbols fit together

Read from left to right, using only 0 and 1. From the right, the places are worth 1, 2, 4, 8, 16, 32, and so on. Add the places that contain a 1.

  1. There are two digits: 0 and 1. Each position to the left is worth twice as much as the previous one.
  2. For 101010, label the places from left to right: 32, 16, 8, 4, 2, 1.
  3. The 1 digits contribute 32, 8, and 2. The 0 digits keep the other positions empty.
  4. Add 32 + 8 + 2 = 42. Moving a digit one position left multiplies its value by two.

0 in Binary

Zero is written as a single 0.

2 in Binary

10: one two and zero ones.

42 in Binary

101010: 32 + 8 + 2 = 42.

181 in Binary

NASA’s example: 10110101 = 128 + 32 + 16 + 4 + 1.

255 in Binary

11111111: eight 1 bits add up to 255.

Enter a nonnegative whole number in decimal. Output uses at most 256 binary digits and omits the optional 0b prefix and leading zeros. Signed, fractional, and fixed-width machine encodings are outside this converter.

History

Leibniz described arithmetic with only 0 and 1 in a 1703 account. Binary place value later became central to digital computing, where each bit has two possible values. This entry presents the modern computing notation rather than assigning binary a single place or date of invention.

How to read it

Read from left to right, using only 0 and 1. From the right, the places are worth 1, 2, 4, 8, 16, 32, and so on. Add the places that contain a 1.

  1. There are two digits: 0 and 1. Each position to the left is worth twice as much as the previous one.
  2. For 101010, label the places from left to right: 32, 16, 8, 4, 2, 1.
  3. The 1 digits contribute 32, 8, and 2. The 0 digits keep the other positions empty.
  4. Add 32 + 8 + 2 = 42. Moving a digit one position left multiplies its value by two.

Limits

Enter a nonnegative whole number in decimal. Output uses at most 256 binary digits and omits the optional 0b prefix and leading zeros. Signed, fractional, and fixed-width machine encodings are outside this converter.

Compare systems