HEX to RGB Converter
Convert HEX color codes to RGB values quickly and accurately for web design and digital projects.
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.
How to convert HEX to RGB manually
A HEX color is just three pairs of hexadecimal (base-16) digits. Convert each pair to a decimal number from 0 to 255.
- Split the 6-digit HEX into three pairs: RR, GG, BB (drop the leading #).
- For each pair, multiply the first digit by 16 and add the second digit (A=10, B=11, … F=15).
- The three results are your Red, Green and Blue values.
Example: #4F8AB2 → 4F = 4×16 + 15 = 79, 8A = 8×16 + 10 = 138, B2 = 11×16 + 2 = 178 → rgb(79, 138, 178).
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"]
}
}
} Frequently Asked Questions
Often used together with: Get color palette from photo · Image color picker