# Color converter > How do you write a colour as HEX, RGB or HSL? Pick or type any colour and copy it as HEX, RGB, HSL, HWB or OKLCH, with its nearest CSS name. Convert any colour between HEX, RGB, HSL, HWB and OKLCH. Pick or type a colour, copy each format, and see its nearest CSS colour name and tints and shades. - Page: https://how.box/color/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/color/?c={c} - `c` (text): The color, as any CSS color text (with or without the # of a hex color). Example: `#2563eb`. Example answer: https://how.box/color/?c=%232563eb A complete link carries the primary answer in the page HTML; a missing or invalid value shows the default page. ## Agent tools - `color_convert`: Converts one CSS color between HEX, RGB, HSL, HWB and OKLCH and finds the nearest CSS named color and a row of tints and shades. - MCP, one POST to https://how.box/mcp: `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"color_convert","arguments":{"color":"#2563eb"}}}` - GET: https://how.box/mcp/run/color_convert?color=%232563eb ## How it works A screen makes a colour by mixing red, green and blue light. RGB and HEX write that mix directly: HEX is the same three amounts in base 16, so #1a73e8 means red 26, green 115, blue 232. HSL and HWB describe the same colour the way people think of it, as a hue on the colour wheel plus how pale, dark or gray it is. OKLCH is a newer description in which lightness is close to what the eye sees: two colours with the same lightness look equally light, which sRGB-based HSL does not guarantee (CSS Colour Module Level 4; Ottosson, 2020). The tints and shades keep the hue and the chroma and change only the OKLCH lightness, so the row looks evenly stepped. Where a colour cannot be shown at that lightness, the chroma is lowered until it fits. The nearest CSS name is the one of the 148 named colours with the smallest difference in OKLab, a space built so that equal distances look equally different. A colour given outside the ordinary screen range (sRGB) is shown as the closest colour that fits. ## FAQ **What does the 8-digit hex code mean?** The last two digits are the opacity, from 00 (invisible) to ff (solid). A colour with less than full opacity is written with them, and its swatch sits over a checkerboard. **Why can two colours with the same HSL lightness look different?** HSL lightness is a calculation on the screen's red, green and blue values, not on how bright a colour looks. Yellow looks much lighter than blue at the same HSL lightness, which is why OKLCH is used for the shades. **Which format should I use in CSS?** Any of them works in current browsers. HEX is the most common and shortest, HSL is easy to adjust by hand, and OKLCH is best for building evenly stepped palettes and can show colours beyond sRGB on wide-gamut screens. **Does the nearest CSS name exactly match my colour?** Not always. The tool distinguishes an exact match from the nearest named colour. **Can it convert paint colours or ICC profiles?** No. It works with CSS colours, not physical paint systems or ICC colour profiles. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)