Hex Calculator / Converter
Use this tool in hex calculator mode to perform algebraic operations with hex numbers (add, subtract, multiply and divide hexadecimals). Use it in hex converter mode to easily convert a hex number to a decimal number, or a decimal number to a hex one (decimal to hex and hex to decimal converter), or to convert hex to binary and binary to hex.
What is a hex number?
A hex number, short for hexadecimal number, is a number expressed in the hexadecimal positional numeral system with a base of 16 which uses sixteen symbols: the numbers from 0 to 9 and the letters A,B,C,D,E, and F, to represent values from 0 to 15. Equivalently, small-case letters a through f can be used. For example, 10 in decimal is A in hex, 100 in decimal is 64 in hex, while 1,000 in decimal is 3E8 in hex. Hex numbers have signs, just like decimal ones, for example -1e is equal to -30 in decimal.
Hex numerals are used mostly in computing: computer system designers, software engineers and programmers as a convenient representation of the underlying binary systems. People in such occupations are most likely to be in need of a hex calculator or hex converter.
An ordinary person would encounter them every day when browsing the web since in website addresses (URLs) special characters are encoded as a hex numeral, e.g. %20 stands for "space" (blank). A lot of webpages also encode special characters in html in terms of their hexadecimal numerical character reference (code), e.g. ’ is the Unicode for a single quotation mark (’). A regular person browsing the web should not require a hexadecimal converter or calculator to do so.
Using our hex calculator, you can perform arithmetic operations (addition, subtraction, multiplication and division of hex numbers) as well as use it as a hex converter for hex to decimal, decimal to hex, hex to binary and binary to hex conversions.
Here is a table of some numbers represented in the decimal, hex and binary systems (base 10, base 2 and base 16).
Converting to and from hex numerals
Converting numbers to and from hex does not change the number itself, it just changes its form. Using our hex converter above, you can do both types of conversions quickly and easily. Note that hex conversion and hex calculation are separate operations and you do not need to perform one in order to perform the other.
Hex to decimal
Each position in a hexadecimal numeral represents a power of 16 the same way each position in a decimal number represents a power of 10. For example, the number 20 in decimal is 2 · 101 + 0 · 100 = 20. The hex number 20 is then 2 · 161 + 0 · 160 = 32 in dec. Similarly, the number 1E is 1 · 16 + 14 · 1 = 30 in decimal.
The process of hex to decimal conversion is therefore to first take each position and convert it to decimal, e.g. 9 is 9, but B is converted to 11, then to multiply each position by 16 to the power of the position number, counting from right to left and starting at zero. If you need to calculate large exponents like 168 you might find our exponent calculator useful.
Decimal to hex
This process is a bit more complex as we are going from a higher base to a lower base. Let us say the number we want to convert from decimal to hex is X. Begin by finding the largest power of 16 ≤ X and denote it by E. Then determine how many times the power of 16 found above goes into X, denote it by Z1. Denote the remainder by Y1.
Repeat the above steps using Yn as a starting value until 16 is larger than the remaining value and assign the remainder to the 160 position, then assign each of the values Y1...n to its respective position and you will have your hex value.
Example dec to hex conversion: Convert 1000 in decimal to hex.
1.) Largest power E = 2 (162 = 256 ≤ 1000, 163 = 4,096 ≥ 1000)
2.) Z1 = 1000 / 162 = 3 (232 remainder); Y1 = 232
3.) Largest power E = 1 (161 = 16 ≤ 232, 162 = 256 ≥ 232)
4.) Z2 = 232 / 161 = 14 (8 remainder); Y2 = 8
5.) 8 < 16; Z3 = 8, end.
Combine Z1..n to get 3E8 (14 dec = E hex). You can verify the result using our hex converter.
Hex to decimal and decimal to hex conversion follows the same principles, but with base 2 instead of base 10.
Algebraic operations with hexadecimal numbers
Using our tool in hexadecimal calculator mode you can perform the four basic arithmetic operations on hex numbers: addition, subtraction, multiplication and division. Therefore it doubles as a hexadecimal addition calculator, hexadecimal subtraction calculator, etc. In order to do the hexadecimal calculations yourself most would prefer using a table for smaller numbers and a base 16 calculator for larger ones. Subtraction works the same way as any other number system, except when borrowing a number you need to borrow a group of 1610 instead of 1010 as you would with decimals.
Hexadecimal arithmetic calculation examples
A few examples of using base 16 numbers will be instructional in showing that it works the same as with decimal numbers. First, something simple: add 416 and F16. Adding it results in 316 and a carry of 116 (192 = 161 + 3) which we simply prepend to 316 to get the result: 1316.
For a more complex addition example let us add the hex numbers 3F16 and 6416. Starting from right to left:
- (1) Add 416 and F16, resulting in 1316, which is 316 and carry 116 over to the left.
- (2) Add 316 and 616, then add 116 from the carryover, resulting in A16.
- Write the outcome of (2) and (1) next to each other to get the result is A316.
This is how hex addition works. Other base 16 arithmetic operations are performed in a similarl fashion to their decimal counterparts.
Cite this calculator & page
If you'd like to cite this online calculator resource and information as provided on the page, you can use the following citation:
Georgiev G.Z., "Hex Calculator", [online] Available at: https://www.gigacalculator.com/calculators/hexadecimal-calculator.php URL [Accessed Date: 30 Nov, 2020].