Color Code Converter

Free Color Code Converter — HEX, RGB, HSL Formats All-in-One

Convert HEX to RGB, RGB to HSL, and more in real-time. Copy CSS, Tailwind, and design tokens instantly.

#6366F1

Medium Slate Blue

Click to Share
HEX#6366F1
HEXA#6366F1FF
RGBrgb(99, 102, 241)
RGBArgba(99, 102, 241, 1)
HSLhsl(239, 84%, 67%)
HSLAhsla(239, 84%, 67%, 1)
CMYKcmyk(59%, 58%, 0%, 5%)

Auto Detect Input

HEX · RGB · HSL

Opacity

100% (1)

RGBA

rgba(99, 102, 241, 1)

HSLA

hsla(239, 84%, 67%, 1)

HEX + Alpha

#6366F1FF

HEX

6-digit hex code

#

RGB Red · Green · Blue

R
G
B

HSL Hue · Saturation · Lightness

H
S
L

Contrast Checker

Sample Text Aa

Normal body text

Compare color

#FFFFFF

4.47:1

contrast ratio

👁 Blindness Sim

Normal vision

</> Export

Name:
--primary: #6366f1;
--primary-rgb: 99, 102, 241;
--primary-hsl: 239deg 84% 67%;

Share

Current

#6366F1

Medium Slate Blue

rgb(99, 102, 241)

Quick Presets

Complete Guide

Color Code Converter
HEX · RGB · HSL · CMYK & More

A professional-grade tool trusted by designers, developers, and accessibility engineers. Convert any colour format instantly, check WCAG contrast, simulate colour blindness, and export production-ready code — all from one place, no sign-up required.

6+

Color Formats

5

Export Options

5

Blindness Sims

None

Data Stored

The Fundamentals

What Is a Color Code?

Why the same purple can be written six different ways — and when to use each

The Core Idea

Numbers describing light

A colour code is simply a precise numeric description of a colour — specific enough that two completely different computers will display the exact same shade. Without standardised colour codes, "blue" means something different to every monitor, printer, and app.

Different fields evolved their own colour models because they solve different physical problems: HEX and RGB describe emitted light from screens, HSL describes human perception of colour, and CMYK describes ink absorption on paper. All four can describe the same colour — just from different perspectives.

Same Purple, Six Formats

HEX#6366F1
RGBrgb(99, 102, 241)
RGBArgba(99, 102, 241, 1)
HSLhsl(239, 84%, 67%)
HSLAhsla(239, 84%, 67%, 1)
CMYKcmyk(59%, 58%, 0%, 5%)

HEX

Most Common
#6366F1

6-digit hexadecimal — the universal web standard. Used in every CSS file, design tool, and brand guideline. Compact, human-readable, and universally supported.

Best for: Web CSS, SVG, HTML attributes, design tokens

RGB

Screen Native
rgb(99, 102, 241)

Red, Green, Blue on a 0–255 scale. Mirrors how screens physically emit light. Each channel mixes additively — all 255s give white, all zeros give black.

Best for: CSS styling, canvas/WebGL, image processing

RGBA

Transparency
rgba(99, 102, 241, 0.75)

RGB with a fourth alpha channel (0–1) controlling transparency. Essential for overlays, glassmorphism effects, and layered UI elements.

Best for: Transparent overlays, glass UI, modal backdrops

HSL

Designer-Friendly
hsl(239, 84%, 67%)

Hue (0°–360°), Saturation (%), Lightness (%). Designed for human intuition — you can 'think' in HSL: rotate hue to change color family, drop saturation to grey it out, lower lightness to darken.

Best for: Theme generation, accessible palettes, dark/light modes

HSLA

Design Systems
hsla(239, 84%, 67%, 1)

HSL extended with alpha. Lets you create transparent color families while keeping the intuitiveness of the HSL model. Perfect for design systems.

Best for: Design systems, theming with opacity variants

CMYK

Print & Press
cmyk(59%, 58%, 0%, 5%)

Cyan, Magenta, Yellow, Key (Black). The subtractive color model used in print. Screen colors must be converted carefully — bright digital blues often cannot be reproduced exactly in print.

Best for: Print design, brand guidelines, packaging

Tool Guide

How to Use Every Feature

A step-by-step walkthrough of every panel — from input to export

01

Paste Any Color Format — Auto Detected Instantly

Type or paste any colour value into the Auto Detect Input field at the top. The parser intelligently recognises HEX (#6366F1), RGB (rgb(99, 102, 241)), HSL (hsl(239, 84%, 67%)), or their alpha variants — no format selection needed. Hit Apply and all output fields populate simultaneously. The large colour swatch on the left updates live.

02

Adjust Opacity with the Slider

The Opacity panel lets you drag a slider from 0 (fully transparent) to 100 (fully opaque). As you move it, the RGBA, HSLA, and HEX+ALPHA fields update in real time. The colour preview reflects the transparency against a checkerboard background, just like Figma or Photoshop. Copy any transparent variant with one click.

03

Copy Individual Format Outputs

Each output row — HEX, HEXA, RGB, RGBA, HSL, HSLA, CMYK — has its own Copy button. Click once and the value is on your clipboard, ready to paste into your CSS, design tool, or brand document. The RGB, HSL channels also have individual sliders so you can fine-tune and see every format update together.

04

Check Accessibility Contrast Ratio

The Contrast Checker panel shows your colour displayed as a text block over a white background, with the calculated WCAG ratio. A 4.47:1 result passes AA but not AAA — you'll see this clearly labelled. Click the compare swatch to pick a custom background colour, useful for checking dark themes or coloured card backgrounds.

05

Simulate Color Blindness

The Blindness Sim panel renders your colour swatch under five perceptual filters: Normal, Deuteranopia, Protanopia, Tritanopia, and Achromatopsia. Click each button to see how your colour looks to users with that type of colour vision deficiency. Use this to validate UI states — a green success / red error pattern that's invisible under Deuteranopia needs additional differentiation.

06

Export Production-Ready Code

The Export panel offers five format tabs: CSS Variables, Tailwind, Design Token (JSON), SCSS, and Swift/iOS. Type a variable name (e.g. 'primary', 'brand-blue') and the code block below updates instantly. Hit Copy Code to grab the snippet. This is designed to eliminate the manual work of translating a colour pick into framework-specific syntax.

07

Share a Permanent Color Link

The Share panel shows your current colour name, HEX value, and RGB breakdown, plus a row of quick preset colours. Click Share to generate a unique URL that encodes the exact colour state. Anyone with the link sees the same colour, fully loaded, on any device. Perfect for design handoffs, Slack messages, or client approvals.

Use Cases

Built For Real Workflows

How designers, developers, and accessibility teams use this tool every day

UI/UX Designers

  • Convert client brand HEX codes to HSL for palette generation
  • Check WCAG contrast before handing off to developers
  • Simulate color blindness to validate accessible designs
  • Export tokens directly to CSS, Tailwind, or SCSS

Frontend Developers

  • Auto-detect pasted HEX, RGB, or HSL — no format guessing
  • Copy any format with one click into your stylesheet
  • Generate CSS variable snippets ready to paste
  • Adjust opacity slider to get RGBA/HSLA values instantly

Brand & Print Teams

  • Convert digital HEX to CMYK for print-ready color specs
  • Share a permanent color link with printers or vendors
  • Get the official color name (e.g. 'Medium Slate Blue')
  • Verify screen vs. print conversion fidelity

Accessibility Auditors

  • Run instant WCAG 2.1 contrast ratio checks (AA & AAA)
  • Preview UI against 5 color blindness simulation types
  • Iterate foreground/background until contrast passes
  • Document passing ratios in accessibility reports
Accessibility

WCAG Contrast & Color Blindness

Why accessible colour is not optional — and how to get it right

WCAG 2.1 Contrast Requirements

AA Normal

Body text, paragraphs

4.5:1

AA Large

18pt+ or 14pt bold text

3:1

AAA Normal

Enhanced body text

7:1

AAA Large

Enhanced large text

4.5:1

UI Components

Buttons, icons, input borders

3:1

* The Contrast Checker in this tool measures your colour against white by default. Click the compare swatch to set a custom background.

Color Vision Deficiency Types

Deuteranopia~5% of men

Red-green (green weak)

💡 Avoid green/red-only signals. Add icons or patterns.

Protanopia~1% of men

Red-green (red weak)

💡 Red appears very dark. Never rely on red alone for errors.

Tritanopia~0.01%

Blue-yellow

💡 Rare but blue/yellow confusion. Use contrast + labels.

Achromatopsia~0.003%

Full color blindness

💡 Only luminance visible. Ensure strong contrast ratios always.

The Real Cost of Inaccessible Color

Estimated 300 million people worldwide have colour vision deficiency

Legal ExposureWCAG 2.1 AA is legally mandated for public sector websites in the EU (EN 301 549) and increasingly referenced in US ADA litigation. Failing contrast checks is an auditable, documentable failure.

Business ImpactRoughly 4.5% of your users see your UI differently. A red error state that looks identical to grey for protanopes means lost form completions, failed purchases, and support tickets.

Simple FixNever communicate information by colour alone. Pair colour with shape, icon, text label, or pattern. Check contrast ratios before shipping. Use the Blindness Sim here to validate every UI state.

Developer Export

Production-Ready Code Snippets

Export your colour in any format your codebase expects — no manual conversion

CSS Variables

--primary: #6366f1;
--primary-rgb: 99, 102, 241;
--primary-hsl: 239deg 84% 67%;

Paste directly into your :root{} block. Works with every CSS framework.

Tailwind Config

colors: {
  primary: '#6366f1',
  'primary-light': '#818cf8'
}

Drop into tailwind.config.js for instant utility class access.

Design Token

{
  "primary": {
    "value": "#6366f1",
    "type": "color"
  }
}

W3C Design Tokens format. Compatible with Style Dictionary and Theo.

SCSS / Sass

$primary: #6366f1;
$primary-rgb: 99, 102, 241;
$primary-hsl: 239, 84%, 67%;

SCSS variables for traditional Sass-based projects.

Swift / iOS

UIColor(red: 0.388, green: 0.400,
  blue: 0.945, alpha: 1.0)

UIKit and SwiftUI compatible UIColor initializer.

Pro Tip: Variable Naming

Use semantic names in the Export Name field, not descriptive colour names. --primary ages better than --blue — because when you rebrand to green, all your variables still make sense.

--blue-500--primary
--red--danger
--light-grey--surface-2
Color Theory

Use HSL to Think in Colors

The most underrated trick for building consistent, beautiful palettes from a single colour

🌈

H — Hue

0° to 360°

Think of this as the colour family wheel. 0°/360° = red, 120° = green, 240° = blue. Rotating hue 30° creates a harmonious adjacent colour. Rotating 180° gives the exact complement (opposite colour on the wheel).

💡 Rotate ±30° for analogous palettes, ±180° for complementary accent.
💧

S — Saturation

0% to 100%

Controls colour intensity. 100% is vivid and fully saturated. 0% is completely grey — the same lightness but with no colour at all. Dropping saturation while keeping hue and lightness constant creates 'muted' tones that are softer on the eye.

💡 Drop to 15–30% for subtle backgrounds; keep 70–90% for interactive elements.
☀️

L — Lightness

0% to 100%

0% is always black, 100% is always white, 50% is the 'pure' colour. This channel is what makes dark mode trivial in HSL — swap L:65% for L:35% and the colour adapts perfectly, keeping hue and saturation identical.

💡 For dark mode, subtract 30–35 from Lightness. That's it — no new colour variables needed.

Dark Mode Palette Recipe Using HSL

Primary

hsl(239, 84%, 67%)hsl(239, 84%, 55%)

Slightly darker to pop on dark bg

Surface

hsl(239, 20%, 97%)hsl(239, 20%, 12%)

Keep hue, flip lightness extremes

Text

hsl(239, 15%, 10%)hsl(239, 15%, 90%)

Mirror: dark text ↔ light text

Border

hsl(239, 20%, 88%)hsl(239, 20%, 22%)

Subtle — same hue, mid lightness

All four colours share Hue 239 — the palette feels cohesive even as lightness flips between modes.

FAQ

Questions We Actually Get Asked

Honest, detailed answers from people who've built with colour every day

Why Us

What Makes This Converter Different

Built by designers and developers, for designers and developers

All Formats in One View

Most converters show one output at a time. This tool shows HEX, HEXA, RGB, RGBA, HSL, HSLA, and CMYK simultaneously — so you copy exactly what you need without toggling.

Auto-Detect: No Format Selection

Paste any colour string from anywhere — Figma, CSS, Sketch, a design brief, a Slack message — and it just works. The parser handles all formats including shorthand and functional notation.

WCAG Contrast Checker Built In

No third-party tab needed. Pick your foreground and background, see the ratio, and know instantly if you're AA or AAA compliant. Iterate until you pass.

5-Mode Blindness Simulation

See your colour through the eyes of every major colour vision deficiency type. Normal, Deuteranopia, Protanopia, Tritanopia, and Achromatopsia — all one click away.

Framework-Native Export

Skip the manual conversion. Get CSS Variables, Tailwind config, W3C Design Tokens, SCSS, and Swift/iOS code in one click. Semantic variable naming baked in.

Shareable Color URLs

Every colour you pick gets a permanent, shareable URL. Send it to a colleague and they land on the exact colour — no copy-paste errors, no 'which blue?' ambiguity.

UntangleTools Logo
UntangleTools Logo
UntangleTools Logo