Skip to content
YAS.SH
Text & Data🌐 YAS server-sideAPI availableintermediate

Color Converter

Converts colors between HEX, RGB, HSL, CMYK and shows WCAG contrast ratios.

Processed by YAS · not stored
Ready to runInstant execution
All tools →
Result
—

What does this tool do?

Converts colors between HEX, RGB, HSL, CMYK and shows WCAG contrast ratios.

Why would I use it?

  • You need a color in a different format for code.
  • You are checking text/background contrast for accessibility.
  • You want to lighten/darken a color.

Real-life example

Input
#6366f1
Output
rgb(99,102,241) · hsl(239,84%,67%) · contrast vs #fff: 5.1:1

Every format is shown simultaneously.

Input → Process → Output → Next

Input
Enter a color in any supported format.
Process
YAS converts between models and computes contrast.
Output
All formats plus contrast ratios.
Next action
Choose combinations that pass WCAG AA (≥4.5:1 for text).

Common mistakes

  • Using contrast calculators on colors with alpha.
  • Assuming RGB and sRGB values are interchangeable.
  • Ignoring color blindness when pairing colors.

What the result means

Contrast ratio measures readability between two colors.

Privacy & security

Your input is sent to YAS infrastructure because the tool requires server-side processing or public network queries. Input is not stored.

API

Endpoint
POST https://yas.sh/api/v1/tools/color-converter
Request Header
Content-Type: application/json
cURL
curl -X POST "https://yas.sh/api/v1/tools/color-converter" \
  -H "Content-Type: application/json" \
  -d '{"input":"#6366f1"}'
JavaScript
const res = await fetch("https://yas.sh/api/v1/tools/color-converter", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "input": "#6366f1"
}),
});
const data = await res.json();
Python
import requests

r = requests.post("https://yas.sh/api/v1/tools/color-converter", json={"input":"#6366f1"})
data = r.json()
FieldTypeRequiredDescription
inputstringYes#hex, rgb(), hsl(), or basic color name
Success response
{ "result": { "hex": "#6366f1", "rgb": "rgb(99, 102, 241)", "hsl": "hsl(239, 84%, 67%)", "contrastWhite": 4.87, "bestText": "white" } }

Convert a color to HEX / RGB / HSL / CMYK / HSV + WCAG contrast ratios.

Error responses
  • 400 VALIDATION_ERROR — invalid input or unsupported option.
  • 413 PAYLOAD_TOO_LARGE — input exceeds the 64 KB limit.
  • 429 RATE_LIMIT_EXCEEDED — rate limit exceeded (60 req/min).
Limits
  • Maximum input: 64 KB per request.
  • Rate limit: 60 requests/min per IP address.
  • Authenticated accounts benefit from higher tier quotas.
Related tools
Ask YAS AI
🍪 Cookies & privacy. Essential cookies keep you signed in and remember language and theme. Google AdSense and reCAPTCHA are Google technologies: AdSense runs only after Accept All; reCAPTCHA loads on sign-in and contact forms. See how Google uses data: https://policies.google.com/technologies/partner-sites cookie policy · privacy policy.
Settings