Skip to main content
AllDevToolsHub
🎨

Color Format Converter

100% Local

Convert colors between HEX, RGB, RGBA, HSL, HSV, CMYK, and CSS named colors.

Color Format Converter

Color Converter

8 formats
Luminance: 0.2355
vs White: 3.68:1
vs Black: 5.71:1
HEX#3B82F6
HEX8#3B82F6FF
RGBrgb(59, 130, 246)
RGBArgba(59, 130, 246, 1)
HSLhsl(217, 91%, 60%)
HSLAhsla(217, 91%, 60%, 1)
HSVhsv(217, 76%, 96%)
CMYKcmyk(76%, 47%, 0%, 4%)
CSS NameNo close match
Try:
This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.

Enter a color in any format (HEX, RGB, HSL, OKLCH). All other formats update as you type.

Overview

What is Color Format Converter?

Convert colors between HEX, HEX8, RGB, RGBA, HSL, HSLA, HSV, and CMYK instantly. Includes alpha control, WCAG contrast, and closest CSS named color.
FAQ

Frequently Asked Questions

Reference

Technical Deep Dive

CONVERTERS

Color Format Converter

Convert any color between HEX, HEX8 (with alpha), RGB, RGBA, HSL, HSLA, HSV, and CMYK formats instantly. Includes alpha channel control, WCAG contrast ratio against white/black, closest CSS named color matching, and a 10-color history. All conversions are computed client-side with pure JavaScript math.

🔁

Two-Way Conversion

Convert in either direction with consistent semantics on the round-trip.

🎯

Type-Faithful

Preserves nulls, numbers, booleans, and structure, no string-soup translation.

📦

Production-Sized

Built to handle real-world payloads, not just textbook examples.

01 Color Space Comparison Matrix

Format Coordinate Basis Design Utility Transparency
HEXRed, Green, BlueStandard Web (Compact)Optional (HEX8)
HSLHue, Sat, LightnessSystematic PalettesYes (HSLA)
HSVHue, Sat, ValueDesign Tool NativeNo
CMYKCyan, Mag, Yel, BlkPrint ProductionNo

02 Perceptual Contrast Workflow

1
Luminance Calculation The algorithm applies gamma correction to RGB channels to calculate relative luminance (Y), reflecting human light perception.
2
Contrast Ratio Derivation The luminance values of the text and background are compared using the (L1 + 0.05) / (L2 + 0.05) formula.
3
Standard Validation The resulting ratio is validated against WCAG thresholds (4.5:1 for AA, 7:1 for AAA) to confirm accessibility.

03 Where Format Conversion Actually Happens

Format conversion is rarely about curiosity, it is about moving a color from one tool's vocabulary into another's without losing information. These are the daily collisions where this converter pays for itself.

  • 🎨
    Figma's rgba() → CSS Custom Property Figma's inspector emits rgba(59, 130, 246, 1). Your design system stores tokens as HEX (or modern HSL/OKLCH). Paste, copy the format you need, paste into --color-primary. No mental math, no truncation.
  • 🕰️
    OKLCH → HEX for Older-Browser Fallbacks You author tokens in OKLCH because it is perceptually uniform. But Safari before 16.4 and any browser used by enterprise IT departments needs a HEX fallback. The converter gives you the matching sRGB hex for the @supports not (color: oklch(...)) branch.
  • 8️⃣
    HEX → HEX8 (#RRGGBBAA) Adding transparency to an existing hex without switching to rgba(): take #3B82F6 and 80% opacity, and out comes #3B82F6CC. Useful when an existing CSS file uses hex everywhere and you want consistency.
  • 🌬️
    Tailwind Arbitrary-Value Syntax Tailwind accepts bg-[#3b82f6], bg-[rgb(59_130_246)], or bg-[hsl(217_91%_60%)], note the space-separated syntax. The converter outputs Tailwind-ready strings (no commas) so they paste straight into JSX without escaping.
  • 🖨️
    CMYK Approximation for Print Drafts Marketing wants a print PDF that "matches the web color." Naive CMYK conversion is wrong for press-ready work, but it is the right starting estimate before a designer takes it into Illustrator with a real ICC profile.

04 Worked Examples

EXAMPLE 1 · ONE COLOR, FOUR FORMATS
Input, paste any of the formats below:
#3b82f6
Converter output, pick the one your toolchain wants:
HEX   #3b82f6

RGB rgb(59, 130, 246)
HSL hsl(217, 91%, 60%)
OKLCH oklch(0.62 0.19 259)


All four describe the exact same sRGB pixel. The differences are how easy each is to edit, HSL for hue/saturation tweaks, OKLCH for perceptually-uniform lightness ramps, HEX for compactness.




EXAMPLE 2 · HEX8 vs RGBA, TWO WAYS TO WRITE ALPHA

The same blue at 80% opacity, two equivalent representations:

rgba(59, 130, 246, 0.8)   /* the classic /

HEX8, RR GG BB AA, where AA = round(0.8 * 255) = 204 = 0xCC:

#3b82f6cc                / same color, hex syntax /

HEX8 is supported in all modern browsers since 2017. Prefer it when your codebase uses hex everywhere, keeps the file visually consistent and lets you grep for color values with one pattern.




EXAMPLE 3 · WHEN HEX → HSL → HEX LOSES PRECISION

Start with a hex, round-trip through HSL, end up slightly different:

#3b82f6  →  hsl(217.218, 91.220%, 59.804%)
→ hsl rounded to "hsl(217, 91%, 60%)"

Convert that rounded HSL back to hex and you get a near-neighbour:

hsl(217, 91%, 60%)  →  #3c83f6   / off by one in R */

HSL stores three integer-ish percentages; HEX stores three bytes. Rounding the middle representation shifts the endpoints by 1-2 channel values. If you need lossless round-trips, store the original hex alongside the editable HSL.




05 Related Tools

Conversion is upstream work. Once you have the format your codebase wants, these adjacent tools handle palette generation, accessibility, and Tailwind integration.

You Might Also Need