---
title: "Use this when you need one color's exact values across every common format."
method: POST
path: "/v1/convert_color"
tags: ["color"]
---

# Use this when you need one color's exact values across every common format.

`POST /v1/convert_color`

## Request

- Base URL: `https://api.clean.tools`
- URL: `https://api.clean.tools/v1/convert_color`
- Auth: none declared

Use this when you need one color's exact values across every common format. Accepts a hex (#abc or #aabbcc), rgb(r, g, b) with r/g/b 0-255, or hsl(h, s%, l%) color and returns hex, rgb {r,g,b}, hsl {h,s,l}, hsv {h,s,v}, cmyk {c,m,y,k}, and oklch {l,c,h} (CSS Color 4: sRGB -> linear -> OKLab -> OKLCH, rounded to 4 decimals). Note oklch.l is 0-1 (not 0-100) and hue is 0 for grays. Deterministic: same input, same output. Example: "#ff0000" -> oklch {l: 0.628, c: 0.2577, h: 29.2339}. Alpha channels are not supported.

## Request body

- object
  - `color` string, required: A color as hex (#abc or #aabbcc), rgb(r, g, b) with r/g/b 0-255, or hsl(h, s%, l%). Alpha is not supported.

## Response `200`

Structured tool result.

- object
  - `tool` string
  - `result` object
    - `hex` string, required: 6-digit lowercase hex, e.g. '#ff0000'.
    - `rgb` object, required
      - `r` integer, required: Red 0-255.
      - `g` integer, required: Green 0-255.
      - `b` integer, required: Blue 0-255.
    - `hsl` object, required
      - `h` integer, required: Hue 0-360 degrees (0 for grays).
      - `s` integer, required: Saturation 0-100 percent.
      - `l` integer, required: Lightness 0-100 percent.
    - `hsv` object, required
      - `h` integer, required: Hue 0-360 degrees.
      - `s` integer, required: Saturation 0-100 percent.
      - `v` integer, required: Value/brightness 0-100 percent.
    - `cmyk` object, required
      - `c` integer, required: Cyan 0-100 percent.
      - `m` integer, required: Magenta 0-100 percent.
      - `y` integer, required: Yellow 0-100 percent.
      - `k` integer, required: Key/black 0-100 percent.
    - `oklch` object, required
      - `l` number, required: OKLCH lightness 0-1 (not 0-100), rounded to 4 decimals.
      - `c` number, required: OKLCH chroma, rounded to 4 decimals.
      - `h` number, required: OKLCH hue 0-360 degrees (0 for grays), rounded to 4 decimals.

## Other responses

- `400`: Invalid input or the tool reported an error.
- `413`: Request body exceeds the 128 KB limit.
- `429`: Rate limit exceeded; the response carries Retry-After and RateLimit-* headers — honor them and add jitter.

---

[API](https://skmtc.dev/clean/apis/clean-tools-api.md) · [All operations](https://skmtc.dev/clean/apis/clean-tools-api/llms.txt) · [OpenAPI document](https://skmtc.dev/clean/apis/clean-tools-api/revisions/a24a01d2833c?raw)
