Every now and then it’s nice to take break from tutorials, and look at something a little geekier. We’ve all seen binary code, and most people know it’s made up of two characters, zero and one. Most people also understand that binary code can be converted into decimal by taking the binary number from the right-hand-side of the sequence and applying it to another sequence of numbers “two to the power of”. For example an eight digit binary code could look like this – “10010001”. This includes one “1”, one “16”, and one “128”, making a grand total of 145. That’s fairly simple. It gets more complex when you add more numbers but the principal is the same.

Now – if you do a lot of HTML work, you will have seen codes that represent colors. These codes include letters, and are in hexadecimal. The letters are actually numbers but because the characters we commonly use are in base 10, i.e. the digits 0 through to 9, we have to use letters to represent the numbers 10,11,12,13,14 and 15. This is because hexadecimal is base 16, and has 16 digits including zero. We don’t use two characters in a hexadecimal number until we get to the number 16, which is actually “10”. This represents one sixteen. The hexadecimal number “18” is actually sixteen plus 8, which is 24. The hex code “1F” represents 31 in decimal because we have one sixteen plus 15. Get the idea?

Okay, so we can mostly work out what a hex number in decimal is when we only have two characters. One digit represents how many “16”s we have, and the other is simply counting from zero to fifteen. So the highest number we have is “FF”, which is fifteen times sixteen, plus fifteen. The answer is 255. Already you can see the benefits of hex, because in binary that number would require eight characters, and we’ve done it in two.

So how do we solve bigger numbers into decimal easier? The answer is to split each hex character into its binary equivalent. So the hex number 8FA4 becomes in binary 1000.1111.1011.0100. Here we can see each number that makes up the ultimate answer. Starting from the left we have a 4, a 16, a 32, a 128 etc… all the way up to the last character, which is a 32,768. Add all the numbers represented by ones together and we have 36772. So our hex code of 8FA4 is actually 36772 in decimal. Four characters to represent something that is sixteen characters in binary is very impressive indeed.

If you remember back your hex codes in HTML that represent colors, you’ll notice that you have hex codes of 6 characters. The first character represents 16’s, the second 16’s to the power 2, the third is sixteen to the power 3 and so on. If you work it out, the largest number you can have with six hex digits is 16,777,215. Nearly seventeen million colors represented by only six characters.

AdvertisementPrevious Post: « Increase your Laptop’s Battery Life with Advanced Power Settings

Next Post: How To Crop Videos With Free Software »

Please click on the following link to open the newsletter signup page: Ghacks Newsletter Sign up

- Time to remove Nano Adblocker and Defender from your browsers (except Firefox)
- Here is what is new and changed in Firefox 81.0
- How to deal with Google's and YouTube's aggressive popups (before you continue, sign in)
- Google proposed Web Bundles could threaten the Web as we know it
- Firefox may soon display Sponsored Top Sites on the New Tab Page
- uMatrix development has ended
- Mozilla Add-ons developers may soon pay Mozilla for reviews and promoted listings
- Microsoft begins Manifest v3 tests in Edge that impacts extensions like content blockers
- Firefox 80.0.1 will be released today. Here is what is new
- Mozilla: there is a high probability that your browsing history can be used to identify you

- Office Web Apps advertisement on Windows 10 PCs
- Time to remove Nano Adblocker and Defender from your browsers (except Firefox)
- Integrate Nano Defender with uBlock Origin to block Anti-Adblocker
- Vivaldi Web Browser Review
- BalloonRSS displays a notification on your desktop to alert you when a new article is available in an RSS feed
- View your Wi-Fi signal strength, auto switch to the better connection with Wifinian
- Keep the contents of two directories in sync with SyncFolders
- Translate Microsoft Office documents or text from any word editor, and get dictionary definitions instantly with GT4T
- Make Windows 10's Start Menu open web searches in the browser and search engine of your choice with Search Deflector
- Digital Clock 4 displays a highly customizable clock widget on your desktop; also supports alarms, hourly chimes and more

**2019**Mozilla working on native Firefox translation feature**2018**Windows 10 version 1809 plagued by another data loss issue**2017**Remove the 3D Objects folder from This PC in Windows 10**2016**Disable Microsoft Windows Malicious Software Removal Tool Heartbeat Telemetry**2015**Should you run Windows Defender and the Malicious Software Removal Tool?

Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.

The name and logo of Ghacks are copyrights or trademarks of SOFTONIC INTERNATIONAL S.A.

Copyright SOFTONIC INTERNATIONAL S.A. © 2005- 2020 - All rights reserved

johnwoosaid on September 21, 2011 at 9:30 am“So the hex number 8FA4 becomes in binary 1000.1111.1011.0100.” … A is 1010.. not 1011.

Defiantsaid on September 21, 2011 at 8:20 pmThis is one of the worst articles I have ever read.

So many inaccuracies, typos, and grammar issues…wow.

1) “It’s gets more complex…”

2) “…split each hex character into it’s binary equivalent”.

“it’s”? Really?

3) “8FA4 is actually 36,788 in decimal”…ehhh…no, it’s 36,772 in decimal.

4) If you have a hexadecimal number that you want to convert to decimal, you don’t have to convert it to binary first.

8FA4 in decimal is 8*16^3 + 15*16^2 + 10*16 + 4 = 36,772.

Even if you chose to convert to binary first, your explanation is severely lacking and unclear.

5) “the third is sixteen’s to the power 3”.

“sixteen”, not “sixteen’s”.

6) “If you work it out, the largest number you can have with six hex digits is 17,895,696”. No… FFFFFF = 16,777,215.

Horrific.

Defiantsaid on September 21, 2011 at 9:44 pm“Nearly eighteen million colors represented by only six characters.” should now be “Nearly seventeen million colors represented by only six characters.”

BlueRajasaid on September 21, 2011 at 11:29 pmSlow news day?

Robsaid on September 23, 2011 at 9:33 amhere is an on-line web app that makes it easy to learn about binary and hexadecimal numbers.

http://justwebware.com/bitwise/bitwise.html

Martin Brinkmannsaid on September 23, 2011 at 9:48 amThanks for posting Rob, great find.

Anonymoussaid on October 23, 2012 at 11:41 amThank You for your tutorial Melanie it was very helpful, also; Thank you Defiant for helping with some unclear examples and showing how to convert hexadecimal to decimal without taking it back to binary code.