Colour Converter
Enter a colour in any supported format and see it in HEX, RGB, HSL and HSV. Copy any value with its button. Everything runs in your browser.
Accepts #f80, #ff8800, #ff880080, rgb(255, 136, 0), rgba(255, 136, 0, 0.5), hsl(32, 100%, 50%) and hsv(32, 100%, 100%).
| Format | Value | Copy |
|---|---|---|
| HEX | - | |
| RGB | - | |
| HSL | - | |
| HSV | - |
How it works
The page reads your colour with one script, colour.js, which works out every format from the same whole RGB values. Nothing is sent to a server and nothing is saved.
Rounding. RGB channels are whole numbers from 0 to 255. A value that falls exactly halfway is rounded up. Hue is shown to 1 decimal place in degrees, and a hue that rounds to 360 is shown as 0. Saturation, lightness and value are shown to 1 decimal place as percentages. Trailing zeros are dropped, so 50.0% is shown as 50%.
Alpha. A 4 or 8 digit HEX value, or an rgba or hsla value, carries an alpha channel from 0 to 1. A HEX alpha byte b gives alpha b / 255, shown to 2 decimal places. A typed alpha is turned into a HEX byte as alpha x 255, rounded half up.
Accepted input. HEX takes 3, 4, 6 or 8 digits, with or without #. RGB takes three whole numbers from 0 to 255. HSL and HSV take a hue from 0 to 360 degrees and saturation, lightness or value from 0% to 100%. Decimals are allowed. Anything else is refused with a message that says what to change.