Convert colors
A single brand color often needs to exist in five different formats before the day is out: HEX for the stylesheet, CMYK for the print vendor, LAB for a color-matching algorithm. The color converter API takes one color in any supported notation and returns it translated into the rest, so no one is eyeballing a swatch and guessing.
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
The problem it quietly solves
Design systems, print shops and web front-ends each grew up speaking a different color language, and the math to move between them is not intuitive — RGB to LAB in particular involves an intermediate XYZ transform and a reference white point that most developers have no reason to remember. Rather than hunting down that formula or copying it from a decade-old blog post, you send the color once and get every representation back, computed the same way every time.
What the request looks like
Provide a color in any one supported format — a HEX string like #1E90FF, an RGB triplet, an HSL value, a LAB set, or CMYK percentages for print — and the task runs asynchronously. A task_id comes back immediately, and moments later the full set of equivalent values arrives by signed webhook or a signed link that stays valid for 24 hours.
Why five formats, not two
HEX and RGB are the web's native vocabulary, but they fall short elsewhere: CMYK is what a commercial printer actually mixes onto paper and doesn't map one-to-one from RGB without loss, HSL is what designers reach for when adjusting a shade's lightness intuitively, and LAB exists precisely because it approximates human perceptual distance between colors, which RGB does not. Supporting all five means the same call serves a front-end developer, a print production team and a QA engineer comparing two colors for perceptual similarity.
Where it fits in a pipeline
Drop it into a design-token build step that generates print-ready assets alongside web ones, a brand-guideline generator that needs every format documented automatically, or an accessibility checker that first normalizes arbitrary user-submitted colors before further analysis. Because it's billed per successful conversion with no subscription surprises, it scales cleanly whether you're converting one brand palette or an entire icon set.
A brief note on precision
Converting into and out of LAB and CMYK is inherently lossy in places — not every RGB color has an exact CMYK equivalent a printer can reproduce, and that's a property of the color spaces themselves, not a shortcut in the math. What this endpoint guarantees is that the conversion formulas are applied correctly and consistently, every time, across every call.
What you can do with it
Design system tooling
Generate HEX, RGB, HSL, LAB and CMYK values for every token in a design system automatically, instead of maintaining them by hand across formats.
Print production handoff
Convert a brand's web-native HEX palette into CMYK percentages before sending final files to a commercial printer.
Accessibility and contrast tools
Normalize arbitrary user-submitted colors into a consistent format before running contrast-ratio or perceptual-difference calculations.
Brand guideline documents
Auto-populate a style guide's color section with every notation a designer or developer might need, generated from a single source color.
FAQ
Which color formats does the color converter API support?
HEX, RGB, HSL, LAB and CMYK — you send a color in any one of them and receive the others computed from it.
Is this color converter API free to use?
The tool above runs free in your browser. The API is paid — each call draws from your prepaid ForHosting KIT balance: top up from $10.00 (it never expires), pay each request's published price, and a call with no balance returns HTTP 402. No subscription, no tokens, and a failed task is never charged.
What's the price per conversion?
$0.002 per request, and you're only billed when the task actually completes successfully.
Why isn't RGB-to-CMYK always a perfect round trip?
CMYK and RGB describe different physical color spaces — one subtractive ink, one additive light — so some RGB colors have no exact printable CMYK equivalent; that's a property of color itself, not a limitation of this API.
How is the result delivered?
Asynchronously: you get a task_id right away, and results follow via a signed webhook or a signed link valid for 24 hours.
Can I convert many colors at once?
Each request handles one color conversion; for bulk palettes, call the endpoint per color as part of an automated batch process.
Does it use a specific reference white point for LAB?
Yes, LAB conversion uses a standard reference white so results are consistent and reproducible across every request.
What happens with an invalid HEX code or out-of-range value?
The task fails with a clear error after up to three retries, and a failed task is never charged.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/data/color-convert \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"items":["valor-1","valor-2"]}'const res = await fetch("https://api.kit.forhosting.com/data/color-convert", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"items": [
"valor-1",
"valor-2"
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/data/color-convert",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"items": [
"valor-1",
"valor-2"
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/data/color-convert", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"items":["valor-1","valor-2"]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"items":["valor-1","valor-2"]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/data/color-convert", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"items": [
"valor-1",
"valor-2"
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "data.color_convert",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_mb | 25 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |