Hex to Binary via the Nibble Method

Here a quick way to preform base conversions between binary and hexadecimal.

Lets use the hex number F4 as our example. A quick short-cut is to break the number into nibbles. A nibble is one half of a byte. The hexadecimal number F stands for the denary (base 10, aka decimal) number 15.

Fifteen is the highest possible value for a hexadecimal number and is also the highest value for a binary nibble, 1111. So we can just assign the hexadecimal value to the nibble and call it quits. The hex number 4 would be 0100 in binary.

All that’s left is to cat both nibbles together to create our binary string, 1111 0100. For fact checking, here how to covert this number into denary format. If you haven’t memorized the binary place values, write them out like this.

128 – 64 – 32 – 16 – 8 – 4 – 2 – 1

Next just put your byte above it and add all bits that have an one above them.

1 1 1 1 0 1 0 0 = 128 + 64 + 32 + 16 + 1 = 244
128 – 64 – 32 – 16 – 8 – 4 – 2 – 1

So F4 and 1111 0100 are both 241 in denary. For a quick sanity check, you can use calculator. If your in Windows, open calculator and click the view tab to switch over to Programmer mode. If your using Linux, you shouldn’t need someone to tell you how to use a calculator 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s