HEX to RGB Converter

Convert HEX color codes to RGB values quickly and accurately for web design and digital projects.

In your browser Updated 05/2026

Paste a HEX color, drag the RGB or HSL sliders, or use the visual picker to convert any color between HEX, RGB, HSL, and CMYK formats in real time.

Pick a color visually
HEX
Paste a 3- or 6-digit HEX code, with or without the # sign.
RGB
HSL
CMYK
%
%
%
%
CMYK is a print color space - values are computed from RGB and rounded to whole percentages.
What is a color converter?

A color converter translates a single color between the formats used across the web, design, and print. The same shade of blue can be written as #4F8AB2, rgb(79, 138, 178), hsl(207, 38%, 50%), or cmyk(56%, 22%, 0%, 30%) - different formats serve different tools, but they all describe the same color.

Color format reference
  • HEX - A 6-character hex code used in CSS and design tools, like #4F8AB2.
  • RGB - Red, Green, Blue components from 0 to 255 - used by CSS and most APIs.
  • HSL - Hue (0-360), Saturation (%) and Lightness (%) - easier to reason about visually.
  • CMYK - Cyan, Magenta, Yellow, Key - the four-channel format used for print.

Use this tool from your AI agent

Free JSON API and Model Context Protocol (MCP) server. No signup, no API key, CORS open. Designed for Claude, ChatGPT, Cursor, scripts and frontend apps.

curl -X POST https://mate.tools/api/v1/color-convert.php \
  -H "Content-Type: application/json" \
  -d '{"color":"#FF5733"}'
import urllib.request, json

req = urllib.request.Request(
    "https://mate.tools/api/v1/color-convert.php",
    data=json.dumps({"color":"#FF5733"}).encode(),
    headers={"Content-Type": "application/json"},
)
with urllib.request.urlopen(req) as r:
    print(json.load(r))
const r = await fetch("https://mate.tools/api/v1/color-convert.php", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({"color":"#FF5733"}),
});
console.log(await r.json());

Add to claude_desktop_config.json (Claude Desktop), ~/.cursor/mcp.json (Cursor), or any other MCP-compatible client:

{
  "mcpServers": {
    "mate-tools": {
      "command": "npx",
      "args": ["-y", "@mate-tools/mcp-server"]
    }
  }
}
API documentation OpenAPI 3.1 npm 60 req/min · 600 req/hour · 1 MB body cap

Frequently Asked Questions

Split the HEX code into three pairs and convert each pair from hexadecimal to decimal. For #4F8AB2: 4F = 79, 8A = 138, B2 = 178, giving rgb(79, 138, 178). The converter does this for you in real time.

HEX, RGB, and HSL all describe the same RGB color in different notations: HEX is compact, RGB is direct channel values, and HSL is intuitive for adjusting hue, saturation, or brightness. CMYK is a separate four-channel space designed for printing - it is computed from RGB and may not perfectly match every screen color.

Yes. Three-digit HEX codes are shorthand where each digit is doubled - so #FA0 expands to #FFAA00. The converter accepts both 3- and 6-digit forms, with or without the leading #.

Screens use additive RGB while print uses subtractive CMYK, and not every RGB color has a perfect CMYK match. Professional design software adjusts for the specific paper, ink, and printer profile - the values shown here are a mathematical conversion useful as a starting point.

RGB channels are clamped to 0-255 and HSL saturation and lightness to 0-100%. Hue is treated as a 0-360 degree value. If you enter a value outside the range, the converter rounds it back into the valid range and updates all other formats accordingly.