Color tools

Color Converter: HEX to RGB, HSL, OKLCH and More

Paste a color in any format and get every other format at once, plus ready-to-paste code for web, iOS, Android, Flutter and Unity.

  • Free foreverNo trial, no paywall, no usage limits.
  • No sign-upOpen the page and start. We never ask for an email to use a tool.
  • PrivateEverything runs in your browser. Your input is never uploaded or stored on our servers.
  • Works offlineOnce the page has loaded, the tool keeps working without a connection.

Nearest named color

dodgerblue

Try a random exampleCopy a share link to this color

#3b82f6

oklch(62.31% 0.188 259.81)

Your color

Paste any CSS color: hex, rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch(), color(srgb …), a named color, cmyk(), hsv(), or 0xAARRGGBB from Android and Flutter code.
HEX
Recognized as HEXRecognized as HEX. Every format below updates live.
Perceptual: moving lightness changes only lightness, at any hue. Best for building palettes.Classic hue, saturation, lightness. Familiar, but equal steps do not look equal across hues.
Sliders edit the color in the chosen model and rewrite the input in the format you typed.
Perceived lightness from 0% (black) to 100% (white). The same value looks equally light at every hue.
62.3%
Colorfulness. 0 is gray; around 0.37 is the most vivid any screen can show. Values past the sRGB edge are flagged.
0.188
Hue angle. OKLCH hues differ from HSL hues: blue sits near 260°, red near 29°.
259.8°
Opacity. Below 100% the HEX gains two digits (#RRGGBBAA) and CSS functions get a / alpha part.
100%

Every format

Click a value to select it, or use the copy button. Rounded for readability; the underlying math keeps full precision.
HEXThe web's everyday notation: #RRGGBB, plus two more digits for alpha (#RRGGBBAA).#3b82f6Copy HEX
RGBRed, green and blue channels from 0 to 255. What screens actually emit.rgb(59 130 246)Copy RGB
HSLHue, saturation, lightness. Easy to tweak by hand, but its lightness is not perceptual.hsl(217 91% 60%)Copy HSL
HWBHue, whiteness, blackness: mix a pure hue with white and black, like paint.hwb(217 23% 4%)Copy HWB
HSVHue, saturation, value (also called HSB). The model behind most color pickers in design apps. Not valid CSS.hsv(217 76% 96%)Copy HSV
OKLCHPerceptual lightness, chroma and hue. The best model for design systems: equal steps look equal.oklch(62.31% 0.188 259.81)Copy OKLCH
OKLABPerceptual lightness plus two color axes. Ideal for smooth gradients and color distance.oklab(62.31% -0.0332 -0.1851)Copy OKLAB
LABCIE L*a*b* (D50), the classic device-independent model used in print and color management.lab(54.62% 8.76 -65.79)Copy LAB
LCHCIE LCH (D50): the polar form of LAB, with lightness, chroma and hue.lch(54.62% 66.37 277.59)Copy LCH
CMYKCyan, magenta, yellow, black ink percentages. Not valid CSS, and a naive conversion: real print needs your printer's ICC profile.cmyk(76% 47% 0% 4%)Copy CMYK
XYZCIE XYZ (D65), the reference space every other model is defined from, written as the CSS color(xyz-d65 …) function.color(xyz-d65 0.2642 0.2355 0.9034)Copy XYZ
color()CSS Color 4 color(srgb r g b) with 0–1 channels. Handy for unclipped, high-precision values.color(srgb 0.2314 0.5098 0.9647)Copy color()
NamedThe closest of the 148 CSS named colors, by perceptual (OKLab) distance.dodgerblue (ΔE 3.6)Copy Named

Copy as code

Paste-ready snippets for web, iOS, Android, Flutter and Unity. Mobile platforms put alpha first (0xAARRGGBB).
CSS variableA custom property for your stylesheet's :root. Reference it anywhere with var(--color-name).--color-brand: #3b82f6;Copy CSS variable
CSS (OKLCH)The same color as a modern CSS oklch() value. Supported by every current browser.color: oklch(62.31% 0.188 259.81);Copy CSS (OKLCH)
Tailwind classTailwind arbitrary value: use the color once without adding it to your theme.bg-[#3b82f6]Copy Tailwind class
Tailwind v4 themeAdd to @theme in your CSS to get bg-, text-, border- utilities named after the color.@theme { --color-brand: oklch(62.31% 0.188 259.81); }Copy Tailwind v4 theme
SwiftUISwiftUI Color in the sRGB color space, components from 0 to 1.Color(red: 0.231, green: 0.51, blue: 0.965, opacity: 1)Copy SwiftUI
UIKitUIColor for UIKit apps (sRGB, components from 0 to 1).UIColor(red: 0.231, green: 0.51, blue: 0.965, alpha: 1)Copy UIKit
Jetpack ComposeKotlin Compose Color from a 0xAARRGGBB literal: alpha comes first.Color(0xFF3B82F6)Copy Jetpack Compose
FlutterDart Color from a 0xAARRGGBB literal. Alpha first: FF is fully opaque.const Color(0xFF3B82F6)Copy Flutter
Android XMLcolors.xml resource. Android hex puts alpha first: #AARRGGBB.<color name="brand">#FF3B82F6</color>Copy Android XML
Unity C#Unity Color32 with 0–255 bytes, exact to the hex value.new Color32(59, 130, 246, 255)Copy Unity C#

Contrast and next steps

How readable text is on this color, measured as a WCAG 2 contrast ratio.

Want a site designed with this level of care? Talk to our team

Quick answer

A color converter rewrites one color in different notations: HEX (#3b82f6), RGB (rgb(59 130 246)), HSL, and perceptual models such as OKLCH and LAB that describe the same color in other terms. Paste any CSS color, or a 0xAARRGGBB value from Android or Flutter, into Playxoft's free Color Converter and every format appears at once with one-click copy. Adjust it with OKLCH or HSL sliders, then copy it as a CSS variable, Tailwind class, SwiftUI, Compose or Flutter color.

  • Any CSS color in
  • 12 formats out
  • OKLCH and HSL sliders
  • Alpha support
  • Nearest named color
  • Swift, Compose and Flutter code
  • Eyedropper
  • Shareable links

How to use the Color Converter

  1. 1Paste or type a color into Your color: hex, rgb(), hsl(), oklch(), a CSS color name, or 0xAARRGGBB from mobile code.
  2. 2Check the badge at the right of the field to confirm which format was detected.
  3. 3Fine-tune the color with the OKLCH or HSL sliders, and set Alpha for transparency.
  4. 4Copy any value from Every format, or a platform snippet from Copy as code.
  5. 5Use the link button on the swatch to copy a share link that reopens this exact color.

Which color format should I use?

Every format below describes the same sRGB color; they differ in what they make easy. Pick by the job, not by habit:

FormatBest forExample
HEXEveryday web code, design handoff#3b82f6
RGBCanvas, image code, anything 0–255rgb(59 130 246)
HSLQuick manual tweaks in CSShsl(217 91% 60%)
HWBTinting and shading a pure huehwb(217 23% 4%)
HSV / HSBDesign-app color pickers (not valid CSS)hsv(217 76% 96%)
OKLCHDesign systems, palettes, themingoklch(62.31% 0.188 259.81)
OKLABGradients, color distance, mixingoklab(62.31% -0.0332 -0.1851)
LAB / LCHPrint and color-managed workflowslab(54.62% 8.76 -65.79)
CMYKRough print values (not valid CSS; see below)cmyk(76% 47% 0% 4%)
XYZThe reference space other models derive fromcolor(xyz-d65 0.2642 0.2355 0.9034)

HEX and RGB are the same numbers in different bases: 3b in hex is 59 in decimal. HSL, HWB and HSV are rearrangements of RGB that are easier to reason about, but they are not perceptual. OKLCH, OKLAB, LAB and LCH are built on models of human vision, which is why they are the right tools for anything that must *look* consistent.

Why does OKLCH matter for design systems?

HSL's lightness is a formula, not a perception. hsl(60 100% 50%) (yellow) and hsl(240 100% 50%) (blue) share "50% lightness", yet the yellow has an OKLCH lightness of about 97% and the blue about 45%. Build a palette in HSL and every hue needs hand-correcting.

OKLCH, from Björn Ottosson's OKLab model, fixes that. Its three numbers are lightness (0–100%), chroma (colorfulness, from 0 up to about 0.4, which CSS treats as 100%; colors inside sRGB stay below about 0.32) and hue (0–360°), and equal lightness looks equally light at every hue. That unlocks things HSL cannot do:

  • Generate tints and shades by changing one number, with the hue staying put (CIE LCH tends to drift blues toward purple; OKLCH was designed to avoid that).
  • Swap a brand hue and keep every contrast ratio roughly intact, because lightness carries most of the luminance.
  • Describe wide-gamut Display P3 colors that HEX cannot express.
:root {
  --brand: oklch(62% 0.19 260);
  --brand-hover: oklch(55% 0.19 260); /* same hue, just darker */
}

Tailwind CSS v4 defines its whole default palette in OKLCH, and oklch() works in Chrome and Edge 111+, Safari 15.4+ and Firefox 113+. If you need to support older browsers, declare a HEX fallback first. When a value falls outside sRGB, this converter flags it and offers Map to sRGB, which lowers chroma while keeping lightness and hue.

How do I write a HEX color with transparency?

Add two more hex digits for alpha: #RRGGBBAA. The alpha digits run from 00 (transparent) to FF (opaque), so 50% opacity is 80 (128 of 255). The four-digit short form works too: #f008 is #ff000088.

OpacityHex alphaOpacityHex alpha
100%FF50%80
90%E640%66
80%CC30%4D
75%BF25%40
70%B320%33
60%9910%1A

Android, Jetpack Compose and Flutter put alpha first: 0xAARRGGBB. CSS #3b82f680 becomes 0x803B82F6 in Flutter. Mixing up the two orders is a classic bug, which is why the converter accepts and outputs both.

Why does my CMYK conversion not match my printer?

Screen-to-ink conversion depends on the paper, the inks and the press, all captured in an ICC color profile (for example FOGRA39 for coated paper in Europe, or GRACoL in the US). The CMYK numbers here use the simple device-independent formula: K = 1 − max(R, G, B), then C, M and Y from what remains. They are useful as a starting point and for understanding a color's ink balance, but they are not press-ready.

For real print work, ask your printer for their profile and convert in a color-managed app such as Photoshop, Illustrator or Affinity. Expect vivid screen colors, especially bright blues, greens and oranges, to come out duller: they sit outside what CMYK inks can reproduce.

Frequently asked questions

Nothing but notation. Both describe the same red, green and blue channels from 0 to 255. HEX writes each channel as two base-16 digits, so rgb(59 130 246) and #3b82f6 are the same color.
Yes, in current versions of Chrome, Edge, Firefox and Safari. For very old browsers, declare a HEX or rgb() value first and the oklch() value second; browsers that do not understand oklch() keep the fallback.
HSL lightness is a simple average of the brightest and darkest RGB channels and ignores how sensitive the eye is to each hue. Pure yellow at 50% HSL lightness is about 97% in perceptual OKLCH lightness, while pure blue is about 45%.
Move the alpha to the front and prefix 0x. #3b82f6 becomes 0xFF3B82F6 (FF means fully opaque), so in Flutter you write Color(0xFF3B82F6). The converter's Copy as code panel builds these for you, including translucent colors.
The color is more saturated than a standard sRGB screen can show. OKLCH, LAB and LCH can describe such colors, but HEX and RGB cannot, so those values are clipped. Map to sRGB lowers chroma until the color fits while keeping its lightness and hue.
The converter measures the perceptual distance in OKLab between your color and each of the 148 CSS named colors and shows the closest one, with its distance as a delta E value. A distance of 0 means an exact match.
No. Every conversion runs in your browser with plain JavaScript. Nothing you type is uploaded or stored; only your slider preference is remembered on your device.

Last updated by the Playxoft engineering team.

From the designers who built this tool

Want your site to look this polished?

Consistent color, crisp typography and fast pages are what make a site feel premium. We build accessible, high-converting websites with design systems that stay consistent everywhere. Send us your site and we will share honest recommendations, free.