About RGB to HEX Converter
An RGB colour mixes red, green and blue light, each from 0 to 255. A HEX colour writes the same three numbers in base 16, two digits each, after a hash sign. For example rgb(28, 176, 152) becomes #1CB098.
Enter three numbers, or paste an rgb() value, and the tool returns the six-digit HEX code in capital letters. It checks that the numbers are valid and shows an error if a value is above 255.
How to use RGB to HEX Converter
- Enter three values between 0 and 255, for example 28, 176, 152, or paste rgb(28, 176, 152).
- Click Run Tool to convert.
- Copy the HEX code into your CSS, design file or theme settings.
Example
Input
rgb(28, 176, 152)
Output
#1CB098
Common uses
- Converting colours from design software that shows RGB into HEX for CSS.
- Entering a colour into a WordPress or Elementor colour field that wants HEX.
- Learning how RGB values map to hexadecimal digits.
Privacy and safety
This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.
Frequently asked questions
How is HEX calculated from RGB?
Each number is converted to base 16 and padded to two digits: 28 is 1C, 176 is B0 and 152 is 98.
Can I convert RGBA?
Only the first three numbers are used, so transparency is ignored. Keep the alpha value separately.
Is lowercase HEX the same?
Yes. #1cb098 and #1CB098 are the same colour. CSS accepts both.