Hex to decimal converter
Hex to decimal converter
Hex to decimal converter or short hex to dec converter is a nice online tool that helps you to convert numbers expressed in the hexadecimal (hex) format to the decimal (dec) format. The hex to decimal converter tool is very useful especially for web developers as they often need to convert from hex to dec and the other way around.
Hex to decimal converter
To convert hex to dec, you are welcome to use our hex to dec converter. The hex to decimal converter (convertor) provided below is based on a simple JavaScript and works three ways. You can enter hex number in the first box, hit TAB on your keyboard (or click outside the box) and get the corresponding value in decimal and binary. You can also enter the decimal value and get the corresponding hex value. Or, you can also click the checkboxes to inpur binary and retrieve hex and dec.
Nice hex to dec tool isn't it? This hex to dec converter works in reverse order as well. To convert from binary, enter ones by clicking the small check boxes. To convert from decimal, enter the number in the appropriate box, and then click outside the box. If you need to convert large decimal numbers, you might want to take a look at our Dec to hex converter.
How do these numbers translate to colors? Every color is composed of red, green, and blue. Each flavor of these color can be expressed in decimal or hexadecimal numbers. If you mix three decimal or hexadecimal numbers, you get a color. How does it work? Take a look at our RGB color picker.
How the hex to dec converter and hex to dec conversion works
The hex to decimal conversion and the logic behind the hex to decimal converter (hex to dec converter) is pretty simple. Converting hex to dec is a two step process in which you first convert from hex to binary and then from binary to decimal.
Let's demonstrate the hex to dec conversion using an example. We will convert hexadecimal number E7. Hex number E7 is a one byte (8 bits) number. E can be expressed with 4 bits and 7 can be expressed with another 4 bits. Take a look at the following print screen:
Why does hexadecimal E equal to binary 1110, and why hexadecimal 7 equals to binary 0111? That is how it has been defined, that is how it works, and this relationship can be seen in the following Hex to decimal conversion table.
Hex to decimal conversion table | ||||||||||||||||
HEX | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
DECIMAL | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
BINARY | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
From a table provided and explained on the dec to hex converter page (see the Dec to Hex and Bin conversion table (expanded above 4 bits)), we know that the first 1 in our example binary 11100111 equals to decimal 27 that is decimal 128. The second 1 in 11100111 equals to decimal 26 that is 64. The third 1 in 11100111 equals to decimal 25 that is decimal 32.
As we are deciphering the whole byte, we need to add all numbers up. In our case, all the ones result in 128 + 64 + 32 + 4 + 2 + 1 which equals to 231. Thus, we came to a conclusion using our hex to decimal converter based on the hex to dec conversion process that hexadecimal E7 equals to binary 11100111 and that equals to decimal 231.
You can see this binary to decimal conversion in the following picture:
In case you have any questions about the hex to dec conversion process, you can ask questions in our discussion forum.
Hex to decimal converter using PHP
There is a function in PHP that can do the hex to dec conversion if you need it for some calculations. The name of the hex to dec conversion function is hexdec(), and the following example shows how it is used:
<?php
echo hexdec(E7) . "\n";
?>
Hex to dec converter in PHP is much easier than hec to dec conversion in JavaScript.
Anything else besides the hex to dec converter?
Of course, we have a lot of other interesting stuff besides the hex to decimal converter.
Dec to hex converter
ASCII to hex converter
RGB color picker
Browser safe colors
How to blur text or image
Decimal to binary converter
Word letter mixer (disorganizer)
How to create Favicon
Have a good day.
It is easy, just include the code provided below into your HTML code.