# Convert RGB to HEX

> Convert RGB color values to HEX online. Free RGB to HEX converter with a worked example and a live color picker with contrast checking.

Hex codes are the most compact way to write colors in CSS and HTML. This converter turns rgb() values into their six-digit hexadecimal equivalent, ready to paste into a stylesheet or design token.

## Example: RGB → HEX

Input:
```
rgb(192, 57, 43)
rgb(29, 209, 161)
rgb(84, 160, 255)
```

Output:
```
#c0392b
#1dd1a1
#54a0ff
```

## How to convert RGB to HEX

1. Take your RGB value, e.g. rgb(192, 57, 43).
2. Convert each channel to a two-digit hexadecimal number.
3. Concatenate them with a leading # to get #c0392b.

## FAQ

### Why is my hex value six characters?

Each of the red, green, and blue channels becomes two hex digits (00–ff), so a full color is six digits plus the leading #.

### Can RGB always be represented as hex?

Standard 8-bit RGB (0–255 per channel) maps exactly to six-digit hex. Alpha needs an eighth pair (#rrggbbaa) or rgba() instead.

## Related converters

- [HEX → RGB](https://www.devkult.com/convert/hex-to-rgb.md)
- [RGB → HSL](https://www.devkult.com/convert/rgb-to-hsl.md)
- [HSL → HEX](https://www.devkult.com/convert/hsl-to-hex.md)

Open the interactive converter: https://www.devkult.com/convert/rgb-to-hex