Browser tool
Color Converter
Convert a color between HEX, RGB, and HSL. Edit any field and the others update with a live preview.
Preview
Enter a HEX, RGB, or HSL value. Editing one field updates the others.
HEX to RGB
Split a 6-digit HEX value into three pairs — red, green, and blue — and read each pair as
a base-16 number from 0 to 255. #3B82F6 becomes
rgb(59, 130, 246). A 3-digit value such as
#38f expands to
#3388ff first.
RGB to HEX
Write each channel as two hexadecimal digits and join them after a
#.
rgb(59, 130, 246) becomes
#3B82F6. Channels are rounded to the nearest whole
number and clamped to 0–255, so an out-of-range value is corrected rather than wrapped.
Accepted formats
HEX: #3B82F6 or
#38f. RGB:
rgb(59, 130, 246) or
59, 130, 246. HSL:
hsl(217, 91%, 60%) or
217, 91, 60.
Rounded values
HSL values are rounded to whole degrees and percentages, so converting back can differ by one step in RGB. Colors are treated as sRGB, the color space browsers use by default.
Related tools
The next step in the same task — and still nothing leaves this browser.