ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Converting binary and hexadecimal numbers to Decimal

Updated on June 27, 2011


Binary numbers are bits, one's and zero's that a computer uses to represent an electronic state. Binary numbers use a base 2 value system instead of the base 10 system that is used with general arithmetic. Using a 2 base system means instead of going by powers of ten i.e. 10,100,1000 etc. the base 2 system goes 2,4,8,16, powers of 2. Binary numbers are long to write and harder to work with than the decimal number system. The number 300 in decimal is written as 100101100 so you can see this can be hard to work with. This is where the hexadecimal system comes into play. The hexadecimal system is a base 16 system, 16, 256, 4096 and so on. Because the hexadecimal system uses the base 16 system it uses about 1/4 as many digits as the binary system. The hexadecimal system uses the base numbers 0-9 and also A,B,C,D,E,F to represent 10,11,12,13,14 and 15 respectively. A chart is shown below showing the conversion values of the decimal system to the hexadecimal and binary system for numbers 0-15.

Decimal, Hexadecimal, and Binary conversion chart


Converting Decimal to Binary and Binary to Decimal

There are a couple of ways to convert decimal numbers into binary numbers. There is the method of comparing descending powers of two and subtracting and there is the short division by two with remainder methods.

Binary to Decimal Descending Powers of Two and Subtraction

Using the comparing descending powers of 2 and subtraction method we will take the decimal number that you want to convert into binary and start with the highest base 2 number that will fit into it. It helps if you make a binary base 2 chart to help out.

Binary (base 2) Power Chart

After creating a chart for your reference then you take the decimal number you want to convert and take the biggest power of two that will fit into it and put a 1 in that spot. Since we used the number 300 earlier lets use it now.

  • 29 = 512. 512 does not fit into 300 so put a 0 in that column. (left most column)
  • 28 = 256. 256 fit into 300. Put a 1 in this column and subtract 300 from 256 to get 44.
  • 27 = 128. 128 does not fit into 44 so put a zero into this column and continue with 44.
  • 26 = 64. 64 does not fit into 44 so put a 0 into this column. Continue with 44.
  • 25 = 32. 32 fits into 44. Put a 1 into this column and subtract 32 from 44 to get 12.
  • 24 = 16. 16 does not fit into 12 so you guessed it. Put a zero into this column and continue with 12.
  • 23 = 8 and 8 fits into 12. Put a 1 in this column and subtract 8 from 12. You are left with 4.
  • 22 = 4 and 4 fits into 4. Put a one in this column and subtract 4 from 4. To get zero.
  • 21 and 20 both cannot fit into zero so you can put a zero into both columns.

After all that work we should have the following 0100101100 which is 300! Good Work!

Short Division By 2 With Remainders

The short division by 2 with remainders approach is easier to utilize.

  • You take the decimal number you want to convert into binary. In this case we will use 300 again and put it into and upside down division sign. )300.
  • Then take 2 and use it as your divisor and put it outside of the division symbol. 2)300. Then you divide as usual and put the quotient below and the remainder to the right. Continue this process until you get 0 as a quotient











  • Go from bottom to top and write your numbers out and voila! We get the same as before! 300= 0100101100!

Binary to Decimal

Converting binary to decimal is fairly simple. Take you binary digits from left to right and multiply out the power of two then add them all together. We'll use 0100101100 or 300 again as we are familiar with it.

  • 0*20= 0
  • 0*21= 0
  • 1*22= 4
  • 1*23 = 8
  • 0*24 = 0
  • 1*25= 32
  • 0*26= 0
  • 0*27= 0
  • 1*28= 256
  • Now we add 256 +32+8+4 to get 300.

Hexadecimal to Decimal and Decimal to Hexadecimal

Hexadecimal to Decimal

Converting hexadecimal to decimal is a simple task. Remember that hexadecimal is a 16 base system and uses the letters A,B,C,D,E,F to correspond to 10,11,12,13,14,15 respectively. We can take the hexadecimal 7F3C and convert it to decimal.

  • 7 * 4096 = 28,672 ( 4096 = 163) +
  • 15 * 256 = 3,840 ( F = 15, 256 = 162 ) +
  • 3 * 16 = 48 ( 161 = 16) +
  • 12 * 1 = 12 ( C=12, 160 = 1)
  • Now we add and get 32,572. That's it we are done!

Decimal to Hexadecimal

Decimal to hexadecimal is also a lot easier than dealing with binary numbers. Here are the steps:

  • Take your decimal number and divide it by 16 because hexadecimal is base 16. We can use 32,572 since we have used it before.
  • 32,572/16 = 2035 with a remainder of 12 and 12 = C. C will go in the right most column.
  • 2035/16 = 127 with a remainder of 3. 3 goes into the next right most column.
  • 127/16 = 7 with a remainder of 15 and 15 = F. F goes into the next right most column.
  • 7/16 = 0 with a remainder of 7. 7 will go into the final column since the quotient is zero we are finished.
  • Our final answer is 7F3C. The same as what we started with!

Hexadecimal to Binary and Binary to Hexadecimal

Hexadecimal to Binary

Hexadecimal to binary is our next topic. Taking a hexadecimal number 4D7F to convert it to binary you simply substitute 4 bits for each hexadecimal digit.

  • 4D7F in binary = 0100|1101|0111 |1111. This number is simple as you can use the chart to convert. Just remember to make sure you break each hexadecimal digit into 4 bit sections.

Binary to Hexadecimal

Binary to hexadecimal is the reverse of hexadecimal to binary. Take you binary number break it down into 4 bits each and multiply by the appropriate power of two. Lets use the example from above.

  • First 4 bits = 1111 = 1*20 = 1, 1*21 = 2, 1*22 = 4, 1*23 = 8. Added together these numbers equal 15 which equals F the right most hexadecimal digit.
  • Next 1110 = 1*20 = 1, 1*21 = 2, 1*22 = 4, 0*23 = 0. Added up these numbers equal 7 the next right most hexadecimal bit.
  • Now we have 1011 = 1*20 = 1, 0*21 = 0, 1*22 = 4, 1*23 = 8. These numbers together give us 13 which is equivalent to D! That goes in the next right most column.
  • Finally our last bit is 0010 = 0*20 = 0, 0*21 = 0, 1*22 = 4, 0*23 = 0. When added together we get 4 our final number.

Final Words

This hub page was written by me, obviously and I have done my best to keep it easy to understand. Writing informative pages for others is a benefit to me as it helps to reinforce my knowledge on topics I need to study on also. I hope that this page will be beneficial for others who would like to learn more about computer language. As I continue to learn it is my goal to publish more information to help others and help me become a better person, student and teacher. To everyone out there good luck and write well!


    0 of 8192 characters used
    Post Comment

    • DRG Da Real Grinc profile image

      Felix J Hernandez 

      7 years ago from All over the USA

      Awesome to have this knowledge simplified, great Hub.

    • profile image

      Andrew Murillo 

      7 years ago

      Great Information.


    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at:

    Show Details
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the or domains, for performance and efficiency reasons. (Privacy Policy)
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)