Quickly convert a number from decimal to binary

⏱️ Estimated Reading Time: ~4 min read
0
(0)

To quickly convert numbers from decimal to binary, you need a good knowledge of 2-to-the-power numbers. For example, 2 10 = 1024, etc. This will allow you to solve some conversion problems in seconds.  Of course, you can spend a long time dividing the number by 2. But it’s better to solve it differently, saving precious time during the exam.

The method is very simple. It works like this: if the number to be converted from decimal is equal to 2 to the power, then that number in binary contains a number of zeros equal to the power. We add a “1” in front of these zeros. 

Examples:

  • Let’s convert the number 2 from the decimal system. 2 = 2 1 . Therefore, in the binary system, the number contains 1 zero. We put “1” in front and get 1 0 2 . 
  • Let’s convert 4 from the decimal system. 4 = 2 2 . Therefore, in the binary system, the number contains 2 zeros. We put a “1” in front and get 1 00 2 . 
  • Let’s convert 8 from the decimal system. 8 = 2 3 . Therefore, in the binary system, the number contains 3 zeros. We put a “1” in front and get 1,000 2. 

In the figure, the binary representation of the number is indicated by squares, and the decimal representation is indicated by pink on the left.

45q34r

The same applies to other numbers “2 to the power”.

If the number to be converted is less than the number “2 to the power” by 1, then in the binary system this number consists only of units, the number of which is equal to the power.

  • Let’s convert 3 from the decimal system. 3 = 2 2 – 1. Therefore, in the binary system, the number contains 2 ones. We get 11 2. 
  • Let’s convert 7 from the decimal system. 7 = 2 3 – 1. Therefore, in the binary system, the number contains 3 ones. We get 111 2.

In the figure, the binary representation of the number is indicated by squares, and the decimal representation is indicated by pink on the left.

r4t134r5

The translation is similar for other numbers, “2 to the power of 1”.

Converting numbers from 0 to 8 can be done quickly either by division or simply by memorizing their binary representation. I’ve provided these examples so you can understand the principle of this method and use it to convert more “impressive” numbers, such as 127, 128, 255, 256, 511, 512, and so on.

You may encounter problems where you need to convert a number that isn’t equal to 2 to a power, but is close to it. It may be greater or less than 2 to the power. The difference between the number being converted and 2 to the power should be small—for example, up to 3. You simply need to know the binary representation of numbers from 0 to 3 without having to translate it.

If the number is greater, then we solve it like this:

First, we convert the number “2 to the power” to binary. Then we add the difference between the number “2 to the power” and the number being converted.

For example, let’s convert 19 from the decimal system. It’s 3 greater than 2 to the power.

19=16+3.

16=2 4 . 16 10 =1 0000 2 .

3 10 = 11 2 .

19 10 = 10000 2 + 11 2 = 10011 2 .

If the number is less than 2 to the power, it’s more convenient to use 2 to the power of -1. We solve it like this:

First, we convert the number “2 to the power of -1” to binary. Then we subtract the difference between the number being converted and the number “2 to the power of -1”.

For example, let’s convert 29 from the decimal system. It is greater than the number “2 to the power of -1” by 2. 29 = 31 – 2. 

31 10 = 11111 2 .

2 10 = 10 2 .

29 10 = 11111 2 -10 2 = 11101 2

If the difference between the number being translated and the number “2 to the power” is greater than three, then the number can be broken down into its components, each part converted to binary and added together.

For example, to convert the number 528 from the decimal system. 528 = 512 + 16. We convert 512 and 16 separately.
512 = 2 9 . 512 10 = 1 000000000 2 .
16 = 2 4 . 16 10 = 1 0000 2 .
Now we add in a column:

456456
r7895

This method allows you to spend minimal time converting numbers from decimal to binary, but only if you have a good understanding of the numbers “2 to the power of.” If not, memorize these numbers. They’re especially useful in computer science problems.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?


Explore More IT Terms


Share this term: Facebook X LinkedIn WhatsApp Email

Leave a Reply

Your email address will not be published. Required fields are marked *