# Decimal to Hex Converter

## Converting Decimal to Hexadecimal

Decimal and Hexadecimal are two ways to write numbers. In general, we use decimal numbers—also refered to as base 10—in our everyday lives. That means that there are 10 possible values (0-9) for each digit represented by a base 10 number. Hexadecimal is written base 16, which gives 16 possible values per digit (0-9, A-F). Hexadecimal is widely used in computer applications because it can perfectly represent a single byte using two digits. Large decimal numbers are also shorter when writing them using hexadecimal, which makes it useful for computer code where succinctness is emphasized.

The conversion between base 10 and base 16 is not terribly complex. The process is the same for converting to any other base.

- Divide the original decimal number by the new base value.
- The remainder of the division operation is the value of the first digit of the converted number.
- Divide the quotient of the division operation by the base value.
- The remainder from Step 3 will be the next digit (to the left) of the base number.

### Example

The below is the representation of the conversion operation of `2348`_{10}

to hexadecimal using the above steps.

Division | Quotient | Remainder |
---|

2348 / 16 | 146 | 12 (C) |

146 / 16 | 9 | 2 (2) |

9 / 16 | 0 | 9 (9) |

Thus, the hexadecimal value of `2348`_{10}

is `92C`_{16}

.