DEV Community

Cover image for Developer Dictionary - Binary Number System
Bhumi
Bhumi

Posted on • Updated on • Originally published at bhumimakes.com

Developer Dictionary - Binary Number System

There are 10 type of people in the world — those who understand binary and those who don't. This is a riddle often printed on t-shirts*. After reading this page you will definitely understand binary (and the riddle).

Humans have ten fingers and ten toes. As children, we learn to count using a decimal number system. Decimal number system has ten distinct digits — 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. We learn about the unit place, 10's place, 100's place and so on. But that is not the only number system possible.

Computers use a binary number system, which has two distinct digits — 0 and 1. That is all. The two number systems are related and here is how we can transfer what we already know about decimal numbers to binary numbers:

Alt Text

The number 5432 has 5 in the 1000th place, 4 in the 100th place, 3 in the 10th place, and 2 in the 1 place (aka unit place). With decimal numbers these are powers of 10. Similarly with binary numbers each 'place' is a power of 2 — 1, 2, 4, 8, 16, 32, 64, 128, and so on. So the number 1101 in Base 2 is equal to the number 8+4+1 = 13 in Base 10.

We can do all of the arithmetic operations with binary (aka Base 2) numbers that we do with decimal numbers as well. Below is an example of decimal and binary addition. Try to do the binary to decimal conversation yourself first and then verify.

Alt Text

So What / Why does this Matter?

Binary numbers are present everywhere in the digital world of computers. The two numbers actually represent two states of a transistor. A transistor is basic building block of modern computer hardware, such as the microprocessor.

Below are two concrete examples of where you may run into binary numbers — Hex code for colors used in web design, IP address used to identify a computer on the Internet. See if you can come up with the binary representation of the for both — the Hex color code as well as the IP address — before looking at the answer. Also try saying the binary string out loud. You can get a nice rhythm, it's fun!

Hex color code expanded to 1 and 0s:

Alt Text

IP address expanded to 1 and 0s:

Alt Text


Read more at here. This is part of a bigger resource called Developer Dictionary

Top comments (0)