Binary for Beginners: Converting From Decimal to Binary in 3 Simple Steps
Binary is a numeric system which uses the symbols 1 and 0 to represent all real numbers.
Depending on the application, think of 1 as being yes, true, or on. Think of 0 as being no, false, or off.
Binary is used internally by almost all modern computers and computer-based devices. It’s one of the first things I learned as a computer science student and I think it’s a very cool system whether you’re into CS or not. I hope you do too.
For this example, I’m using “true” when referring to 1 and “false” when referring to 0. The number I’m converting is the current year, 2017.
The binary system is based on multiples of 2–2 to the 0th power, 2 to the 2nd power, 2 to the 3rd power–and so on. The numbers double in size, growing large quickly. So a number like 2017 is easily convertible because it doesn’t force us to create a big reference chart. Let’s begin.
Step 1: Create a chart with the values of 2. The chart moves right to left and begins with 1, doubles to 2, doubles to 4, doubles to 8, and continues until we arrive at a value larger than the one we are converting. Remember, we are converting 2017.
Step 2: Now we are working left to right, inserting 1’s for true and 0’s for false. The question we are asking is, “Does my number contain this amount?” Does 2017 contain 2048? False. It gets a 0. Does 2017 contain 1024? True. It gets a 1. Once you’ve marked off the 1024 slot, you have 993 left because 2017-1024=993.
The questions continue with, “Does 993 contain 512?” True. It gets a 1. Subtracting 512 from 993 gets 481 and the questions continue. If the value on the chart exceeds your current number, as it does in this example at 16, the slot gets a 0 which basically says, “No, my number does not contain this value.” Repeat the steps until you reach the end.
Step 3: Put your binary number together. Remember: You don’t need to include the 0 under 2048 because it’s a false and won’t affect the value of the final binary number. The reason we include it in the chart is because we don’t know which values are contained within the number unless we find a value that is higher.
We wind up with 11111100001
Bonus Step: Double check your binary number by working in reverse. To do this, you add up every value with a 1 in its column.
1024 + 512 + 256 + 128 + 64 + 32 + 1 = 2017
That’s all there is to it. Converting decimal to binary is surprisingly simple for such an important part of computer science. Later on, I’ll get into numbers with fractions which is a bit trickier but not by much.
Oh, and take a second look at the featured image that says, “There are only 10 types of people in the world: Those who understand binary and those who don’t.” Plug 10 into the chart and you’re now 1 of those 10 people.
To use an automated converter and check your answers, visit this decimal and binary conversion calculator from CUNY Brooklyn College.