Introduction: Convert Decimal to Hexadecimal

Introduction

This instruction set will demonstrate a technique for converting numbers in decimal (base 10) to their hexadecimal representation (base 16). This conversion will first express the number in binary (base 2) before moving to hexadecimal. This extra step is added to make the calculation easier by hand as well as to demonstrate the relationship between the binary and hexadecimal counting systems.

Background

Computers can be described as a series of electric switches. At any given time, a switch can hold one of two states; on or off. This is best represented with the digits 1 and 0. Data is recorded and processed on a computer using the system of ones and zeros known as binary. Binary is a counting system based on only two digits, thus it is referred to as a base 2 number system. Compare that to decimal system used in everyday computations which uses the ten digits from zero to nine, and is therefore called a base 10 system. Hexadecimal is a base 16 system, which uses the ten numerals and the first six letters of the alphabet (A-F) for a total of sixteen characters.

Overview

This Instructable will guide you through the process of converting the decimal number 100 into hexadecimal by way of binary. The process will involve some unconventional notation but will not go beyond basic arithmetic. The conversion is divided up into four major steps: Divide by two, sequence binary number, extend and group, and substitute with hex digits. The process should take around five minutes.

Materials Needed

- Pencil

- Paper

- Calculator (optional)

Step 1: Divide by Two

Note: This step uses an unconventional format for basic long division that will look unusual at first but will save you a lot of work space in the end. Use the photo as a reference for what your work should look like.

The first step towards representing the number 100 in hexadecimal is to divide it by 2 repeatedly in order produce a series of remainders that you will use to piece together a binary sequence.

Work the problem as shown in the picture. Start by dividing 100 by 2 and placing the quotient (50) below the dividend (100). Two divides 100 evenly so record the remainder as 0 off to the right of your division column. If the dividend is not divisible by two then record the remainder as 1. Continue dividing each quotient until you end up with zero.

Step 2: Sequence Binary Number

This step will produce a sequence of binary digits, or bits that represent the number 100. Starting the bottom of the remainders column write the remainders you solved for from left to right in a row. Use the arrows in the picture as a guide to check your work.

Step 3: Extend & Group

This step sets the stage for the final step by preparing the binary sequence for easy conversion to hexadecimal digits. Rewrite your binary sequence from right to left placing a space after every four bits. Finish by adding extra zeros on the left to complete the last group of four bits. Use the picture check your progress.

Step 4: Substitute With Hex Digits

Due to the fact that hexadecimal is a base 16 system and binary is a base 2 system one hex digit can express the same value that four binary digits can express (2^4 = 16). Hexadecimal is used by computer programmers because it can represent large binary numbers in a concise manner.

Use the reference chart given here to replace every four bits with its corresponding hex digit. This is the final step and will yield the base 16 equivalent of 100. Use the pictures to check your progress.

Note: It is conventional to write the number 16 in subscript after your answer to make it clear that your final result is a hexadecimal number.

Step 5: Check Your Work

You can check your work by multiplying each digit in the hex number by the value of its place and then summing the results. You can use this same process to quickly convert binary numbers into decimal as well. Use the images given to observe how this process yields the number 100 from both the binary and the hexadecimal numbers you calculated.