Color converter
Convert colors between HEX, RGB and HSL, preview them, and check text contrast against white and black (WCAG).
White text: 6.29:1 · AA
Black text: 3.34:1 · AA large text only
How it works
Enter a color in any of the three formats and the others update. HEX is what CSS and design tools use most; RGB gives the red, green and blue channels; HSL (hue, saturation, lightness) is easiest for making lighter or darker variants.
The contrast ratios follow WCAG 2.1: 4.5:1 is the minimum for normal text (AA) and 7:1 the enhanced level (AAA).
Questions
- Does it accept 3-digit HEX?
- Yes: #f53 is the same as #ff5533.
- What contrast do I need?
- At least 4.5:1 for body text and 3:1 for large text (24 px, or 19 px bold) to meet WCAG AA.
Do this in your code
The same job is one call to the APIStack API, from any language or as a tool for AI agents over MCP. The free plan includes it.
curl -X POST https://apistack.online/api/utilities/color-format-converter/v1 \
-H "x-api-key: $APISTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"color":"#FF5733","from_format":"hex","to_format":"rgb"}'