Color Converter

Convert colors between HEX, RGB, HSL, HSV, and CMYK with WCAG contrast ratios

GET 1 credit /v1/color-convert
curl "https://devtools.toolkitapi.io/v1/color-convert?color=%23FF5733"
import httpx

resp = httpx.get(
    "https://devtools.toolkitapi.io/v1/color-convert?color=%23FF5733",
)
print(resp.json())
const resp = await fetch("https://devtools.toolkitapi.io/v1/color-convert?color=%23FF5733", {
});
const data = await resp.json();
console.log(data);
# See curl example
Response 200 OK
{
  "hex": "#FF5733",
  "rgb": {"r": 255, "g": 87, "b": 51},
  "hsl": {"h": 10.6, "s": 100.0, "l": 60.0},
  "hsv": {"h": 10.6, "s": 80.0, "v": 100.0},
  "cmyk": {"c": 0.0, "m": 0.659, "y": 0.8, "k": 0.0},
  "css_name": null,
  "contrast": {
    "white": 3.07,
    "black": 6.85,
    "wcag_aa_normal_white": false,
    "wcag_aa_normal_black": true,
    "wcag_aaa_normal_white": false,
    "wcag_aaa_normal_black": false
  }
}

Try It Live

Live Demo

Description

Convert colors between HEX, RGB, HSL, HSV, and CMYK with WCAG contrast ratios

How to Use

1

1. Pass a color value in the `color` query parameter. Supported formats: - HEX: `#FF5733` or `#F53` (3-digit shorthand) - RGB: `rgb(255,87,51)`

2

2. URL-encode the `#` as `%23` in query strings.

3

3. Inspect the response for all color model conversions and WCAG contrast data.

About This Tool

Color Converter takes a color in HEX or RGB format and converts it to every major color model — HEX, RGB, HSL, HSV, and CMYK — in a single call. It also calculates WCAG contrast ratios against white and black backgrounds, making it easy to check accessibility compliance.

If the color matches a named CSS color (e.g. `red`, `teal`, `gold`), the `css_name` field is populated.

Why Use This Tool

Frequently Asked Questions

Which input formats are supported?
HEX (`#RGB` or `#RRGGBB`) and CSS `rgb(r,g,b)` notation. HSL, HSV, and named color inputs are not currently supported.
How are WCAG contrast ratios calculated?
Using the WCAG 2.1 relative luminance formula. A ratio ≥ 4.5:1 passes AA for normal text; ≥ 7:1 passes AAA.
What colors have a `css_name`?
A subset of the CSS named colors is matched, including common names like `red`, `blue`, `green`, `orange`, `teal`, `navy`, `gold`, `silver`, `black`, and `white`.

Start using Color Converter now

Get your free API key and make your first request in under a minute.