## About

In mathematics, hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or alternatively a to f) to represent values ten to fifteen. For example, the hexadecimal number 2AF3 is equal, in decimal, to (2 × 163) + (10 × 162) + (15 × 161) + (3 × 160) , or 10,995.

Each hexadecimal digit represents four binary digits (bits) (also called a "nibble"), and the primary use of hexadecimal notation is as a human-friendly representation of binary coded values in computing and digital electronics. For example, byte values can range from 0 to 255 (decimal) but may be more conveniently represented as two hexadecimal digits in the range 00 through FF. Hexadecimal is also commonly used to represent computer memory addresses.

## Hex-Dec Conversion

Convert a hexadecimal number into its decimal; multiply the decimal equivalent of each hexadecimal digit by the corresponding power of 16 and add the resulting values:

Example1:
C0E7_{16}

1. C = (12 × 16^{3}) = (12 × 4096) =49,152

2. 0 = (0 × 16^{2}) = (0 × 256) = 0

3. E = (14 × 16^{1}) = (14 × 16) = 224

4. 7 = (7 × 16^{0}) = (7 × 1) = 7

C0E7_{16} = (12 × 16^{3}) + (0 × 16^{2}) + (14 × 16^{1}) + (7 × 160) = (12 × 4096) + (0 × 256) + (14 × 16) + (7 × 1) = 49,383_{10}

or

C0E7_{16} = 49,152 + 0 + 224 + 7 = 49,383_{10}

## Bin-Hex Conversion

Convert a binary number into its hexadecimal; divide into groups of four bits. If the number of bits isn't a multiple of four, simply insert extra 0 bits at the left (called padding).

Example1:
10100102 = 0101 0010 (grouped with padding) = 52_{16}

Group1:

8 | 4 | 2 | 1 |

0 | 0 | 1 | 0 |

Answer: 0010 = 2

Group2:

8 | 4 | 2 | 1 |

0 | 1 | 0 | 1 |

Answer: 0101 = 5

0101 0010 = 52_{16}

Example2:
110111012 = 1101 1101 grouped = DD_{16}

## Hex-Bin Conversion

Convert a hexadecimal number into its binary; substitute the corresponding binary digits:

Example1:
0011 1010 = 3A_{16}

Group1:

8 | 4 | 2 | 1 |

0 | 0 | 1 | 1 |

Answer: 0011 = 3

Group2:

8 | 4 | 2 | 1 |

1 | 0 | 1 | 0 |

Answer: 1010 = A (10)

Example2:
1110 0111_{2}

Answer: E(14)7_{16}

## Reference

## Links

## See also

**Hexadecimal**- Binary
- Conversion Table