Four Ways to Describe One Color
A color on screen is a mix of red, green and blue light. RGB describes that mix directly, with each channel from 0 to 255. HEX writes the same three numbers in base 16, so 58 becomes 3a, 123 becomes 7b and 213 becomes d5. HSL and HSV describe the same color by its hue, a position around the color wheel from 0 to 360 degrees, plus how strong it is and how light or bright it is.
This converter accepts a value in any of five forms: HEX, RGB, RGBA, HSL or HSV. It turns that value into an internal red, green, blue and alpha reading, then shows every notation at once. The field you are typing in is left alone while you type, so your input is never rewritten under your cursor.
All arithmetic runs in your browser. Nothing you enter is stored or transmitted.
The conversions use standard formulas. From RGB, HSL takes the largest and smallest channels: their average gives lightness, and the spread between them, scaled by distance from white or black, gives saturation. HSV keeps the largest channel as its value and divides the spread by that value to get saturation. Going the other way, the converter rebuilds each channel from hue, saturation and lightness or value with the usual piecewise formulas, then rounds the results to whole numbers.
Step-by-Step: Every Control Explained
- Input format. Pick the notation of the value you are typing. Switching the format converts the current color into the new notation, so nothing is lost.
- HEX field. Accepts three, six or eight hexadecimal digits, with an optional leading hash. A three-digit value repeats each digit, so #33aa77 is the same as #3a7 written short. Eight digits add an alpha channel from 00 to ff.
- RGB fields. Red, green and blue are whole numbers from 0 to 255.
- RGBA alpha. Transparency from 0 (invisible) to 1 (solid). Decimals such as 0.5 are accepted.
- HSL fields. Hue from 0 to 360 degrees, saturation from 0 to 100 percent and lightness from 0 to 100 percent.
- HSV fields. Hue as above, saturation from 0 to 100 percent and value, the brightness, from 0 to 100 percent.
- Swatch. A live preview drawn over a checkerboard, so any transparency is visible.
- Readouts and copy buttons. Five rows show HEX, RGB, RGBA, HSL and HSV, each with its own Copy button. Channel values are rounded to whole numbers for display.
- CSS custom property. Enter a name that begins with two hyphens, such as --brand-color. The line below it is ready to paste and uses HEX when the color is opaque and rgba() when it is not.
Worked Example
Start with HEX. The color #3a7bd5 has red 58, green 123 and blue 213, from the pairs 3a, 7b and d5. The RGB readout is rgb(58, 123, 213). The RGBA readout is rgba(58, 123, 213, 1) because the color is opaque.
Work out HSL by hand. Divide each channel by 255 to get red 0.227, green 0.482 and blue 0.835. The largest channel is blue and the smallest is red. Lightness is their average, (0.835 + 0.227) / 2 = 0.531, which is 53 percent. The spread is 0.835 minus 0.227, which is 0.608. Saturation is the spread divided by 1 minus the absolute value of (2 x 0.531 - 1), which gives about 0.649, or 65 percent. The hue is 215 degrees. So the HSL readout is hsl(215, 65%, 53%).
HSV from the same numbers. Value is the largest channel, 0.835, which is 83.5 percent and rounds to 84. Saturation is the spread divided by the value, 0.608 / 0.835, about 73 percent. The readout is hsv(215, 73%, 84%).
Short HEX and alpha. Typing #3a7 expands to #33aa77, which is rgb(51, 170, 119). Typing the eight-digit #3a7bd580 keeps the same color and adds alpha 0x80, which is 128 out of 255, about 0.5. The RGBA readout then shows rgba(58, 123, 213, 0.5).
Tips and Common Mistakes
- Enter numbers, not functions. The fields take plain numbers, so type 215 in the hue box, not hsl(215.
- Expect one-step shifts after a round trip. Because RGB uses whole numbers, converting HSL or HSV to RGB and back can change a value by one.
- HSV and HSB are the same model. Some design tools call it HSB. The numbers match, so copy them across directly.
- A six-digit HEX makes the color solid. Typing one resets alpha to fully opaque. Other formats keep whatever alpha you last set.
- Use HSL for tints and shades. Keeping hue and saturation fixed while you change lightness gives a family of related colors, which is easier to manage than several unrelated HEX codes.
- Check contrast separately. This tool converts colors. It does not judge whether text on a background is easy to read.
Frequently Asked Questions
Yes. HSV (hue, saturation, value) and HSB (hue, saturation, brightness) describe the same model and use the same numbers. This tool uses the HSV name.
RGB channels are whole numbers, while HSL and HSV values are shown rounded. A conversion can shift a channel by one step. The field you are typing in is never rewritten, so only the other readouts change.
Yes. Place it inside a :root block or a selector, then use var(--brand-color) elsewhere. Check that the name does not clash with an existing variable.
Alpha describes opacity, where 1 is solid and 0 is fully transparent. An eight-digit HEX value ends in an alpha byte from 00 to ff, where ff equals 1. The RGBA readout writes alpha as a decimal rounded to two places, so the byte 80 appears as 0.5.
No. It works with numeric notations only. Enter the value in one of the five formats instead of a color name.