Loading
/custom-emojis/emojis/contour-map.png
Templates
📚
Articles & Resources
📖
Guides & Support
🎖️
Bounty Program
🌵
CalcTree
In our everyday lives, we use the decimal number system known as base 10. This is an example of a positional number system. Computer science and engineering use other systems, such as binary and hexadecimal numbers, for various purposes.
Binary is a base-2 numerical system that uses only two symbols, 0 and 1, to represent numbers. Binary is used in electronic computer systems because they can be effectively mapped onto real electronic 'switches', which form the bases for modern computation.
Hexadecimal is a base-16 numerical system that uses the numbers 0 to 9 and the characters A to F to represent the values 10-15. Hexadecimal is used to store large numbers with fewer characters than binary and decimal, making it desirable in particular computational processes.

Understanding how to convert between these different number systems is fundamental to electronic and software design. So keep reading to find out how!

Calculation

This calculator is designed to convert decimal numbers from 0 to 1023 into binary equivalents. Since the calculator uses a 10-bit representation, the highest hexadecimal value that can be inputted is 3FF.

Input hexadecimal value



Hex Value
:3F0


Equivalent decimal value



Decimal Value
:1008.0


Equivalent Binary Value



Binary Value
:1111110000


Explanation

So how do we convert between the different systems?
To understand how decimal, binary and hexadecimal values it is pivotal to understand the underlying principles behind their notation.
Take the decimal system, for example, specifically the number 2304. If we break this down into its powers of 10, we can observe each digit as a weighted value of a 10th power.

2304=(2)103+(3)102+(0)101+(4)100=2000+300+0+42304 = (2)*10^3 + (3)*10^2 + (0)*10^1 + (4)*10^0 \\ \: \: \: \: \: \: \: \: \: \: = 2000 + 300 + 0 + 4
We can perform this same step with each digit in a binary number, as each digit represents a power of 2. If we take a binary number, say 100100000000, we can break it down into its constituent parts and better understand how binary numbers function.

100100000000=(1)211+(0)210+(0)29+(1)28+(0)27+(0)26+(0)25+(0)24+(0)23+(0)22+(0)21+(0)20=211+28=2048+256=2304(decimal)100100000000 = (1)*2^11 + (0)*2^10 + (0)*2^9 + (1)*2^8 + (0)*2^7 + (0)*2^6 + (0)*2^5 + (0)*2^4 + (0)*2^3 + (0)*2^2 + (0)*2^1 + (0)*2^0 \\ \: \: \: \: \: \: \: \: \: \: = 2^11 + 2^8 \\ \: \: \: \: \: \: \: \: \: \: = 2048+256 \\ \: \: \: \: \: \: \: \: \: \: = 2304 \: (decimal)
As is the case with decimal and binary, this base-16 number system essentially entails that each digit or character corresponds with a power of 16. If we take a hexadecimal number, say 900, we can break it down again into a set of constituent components.

900=(9)162+(0)161+(0)160=(9256)+(016)+(01)=2304(decimal)900 = (9)*16^2 + (0)*16^1 + (0)*16^0 \\ \: \: \: \: \: \: \: \: \: \: = (9*256) + (0*16) + (0*1) \\ \: \: \: \: \: \: \: \: \: \: = 2304 \: (decimal)
💡Note!
  1. Hexadecimal numbers can be tricky, as A-F represents 10 through 15.
  2. The following table will help with any conversion between the number systems.


Converting Hexadecimal to Binary

Converting from hexadecimal to binary can be achieved using the above table. However, for larger numbers, this proves more difficult, and thus we will highlight a simple method for achieving conversion.
This method will involve converting from hexadecimal to decimal, then from decimal to binary. Let us use an example and explain the process simultaneously. Let's take the hexadecimal number 2D4.
  1. First, we must convert hexadecimal to decimal:

2D4=(2)162+(12)161+(4)160=708(decimal)2D4 = (2) * 16^2 + (12)* 16^1 + (4)*16^0 \\ \: \: \: \: \: \: \: \: \: = 708 \: (decimal)
  1. Next, we must employ the following method to convert to binary:
We will continually divide the decimal number by two until we reach 0, using the remainder to construct the binary number with the first remainder as the least significant bit and the last remainder as the most significant bit.

708/2=354r0354/2=177r0177/2=88r188/2=44r044/2=22r022/2=11r011/2=5r15/2=2r12/2=1r01/2=0r1708/2 = 354 \: r\: 0 \\ 354/2 = 177 \: r\: 0 \\ 177/2 = 88 \: r\: 1 \\ 88/2 = 44 \: r\: 0 \: \\ 44/2 = 22 \: r \:0 \\ 22/2 = \: 11 \: r\: 0 \\ 11/2 = 5 \: r\:1 \\ 5/2 = 2 \: r \: 1 \\ 2/2 = 1 \: r\: 0 \\ 1/2 = 0 \: r \:1
Now we have our equivalent binary number: 1011 0001 00

Details on the conversion

The calculator at the top of this page is designed to convert decimal numbers from 0 to 1023 into binary equivalents. Since the calculator uses a 10-bit representation, the highest hexadecimal value that can be inputted is 3FF.
To convert a decimal value that requires less than 10 bits (less than 512), you can find the last non-zero bit when reading the binary representation vertically from "Remainder_b1" to "Remainder_b10." This last non-zero bit will be the leading 1 in the binary representation.
It's important to note that the binary numbers 01001 and 1001 actually represent the same unsigned binary value. The leading 0 in the former case is discarded during the conversion process.
By following these steps, using this calculator, you can accurately convert decimal values to their binary equivalents!

Here's a detailed breakdown of how this works (control the hex input from the top of the page).

Hexadecimal Value



Hex Value1
:3F0


Decimal Value



Decimal value1
:1,008.00


10-Bit Binary Value



Binary value1
:1,111,110,000.00



Val/2 (Raw)

Val/2 (Fixed)

Binary


504
252
126
63
31.5
15.5
7.5
3.5
1.5
0.5

504
252
126
63
31
15
7
3
1
0

0
0
0
0
1
1
1
1
1
1


Raw Binary
:1111110000



Clean Binary
:1111110000


Conclusion

In this article, we have covered the fundamental principles behind decimal (base 10), binary (base 2) and hexadecimal (base 16) positional number systems.
We highlighted how to convert from binary and hexadecimal to a decimal number as well as conversion from a hexadecimal number to a binary number.
Developing a concrete understanding of these number systems as well as how they relate to each other is a foundational building block for building and developing modern digital systems.