TapCub is live — analytics, insights and live chat, free on one platform

Free tool HEX to RGB and back, plus HSL, CMYK and OKLCH

Type a color the way you have it: #3B6BFF, 59 107 255, hsl(225 100% 62%), a CMYK value from the print guide or an oklch() from a design token. You get every format at once, a preview on your background, and the WCAG contrast ratio with a suggested shade when it falls short.

  • Six formats in, all out
  • WCAG 2.2 contrast
  • Runs locally
Converter

Convert a color

The sample is #3B6BFF, the brand color used as an example on the TapCub live chat page, on a white background. Use the picker, type any format, or try the other samples.

HEX (#rgb, #rrggbb, #rrggbbaa, with or without #), rgb(), hsl(), hsv() / hsb(), cmyk(), oklch(), oklab(), a CSS color name, or just three numbers such as 59, 107, 255.

Used for the contrast check and the preview. Any format.

Read as HEX.

Preview

#3B6BFFColor

Normal text at 16 px. Is this easy to read?

Large text at 24 px

Chat with usText on background 4.43:1

All formats

Calculated from the 8-bit RGB value, so every row describes exactly the HEX you copy.

FormatValue
HEX#3B6BFF
RGBrgb(59, 107, 255)
HSLhsl(225.3, 100%, 61.6%)
HSV / HSBhsv(225.3, 76.9%, 100%)
CMYK (approximate)cmyk(77%, 58%, 0%, 0%)
OKLCHoklch(58.45% 0.2262 265.83)
OKLaboklab(58.45% -0.0165 -0.2256)
RGB, CSS space syntaxrgb(59 107 255)
Decimal integer3894271
Android ARGB0xFF3B6BFF

WCAG 2.2 contrast

Color used as text or an icon on the background.

  • FailAA, normal text (WCAG 1.4.3): needs 4.5:1, this pair has 4.43:1.
  • PassAA, large text, 24 px or 18.66 px bold (1.4.3): needs 3:1, this pair has 4.43:1.
  • FailAAA, normal text (1.4.6): needs 7:1, this pair has 4.43:1.
  • FailAAA, large text (1.4.6): needs 4.5:1, this pair has 4.43:1.
  • PassIcons, borders and form controls (1.4.11): need 3:1 against what is next to them, this pair has 4.43:1.
  • TipNearest shade with the same hue that passes AA for normal text on this background: #3A6AFD (4.50:1). Only OKLCH lightness was changed.

Contrast at a glance

Ratios are truncated, not rounded: 4.499 shows as 4.49 and fails.

PairRatioAA text 4.5Large / UI 3AAA text 7
Color on background4.43:1FailPassFail
White text on color4.43:1FailPassFail
Black text on color4.73:1PassPassFail
CSS
color: #3B6BFF;
color: rgb(59 107 255);
color: hsl(225.3, 100%, 61.6%);
color: oklch(58.45% 0.2262 265.83);
--brand: #3B6BFF;
Runs entirely in your browser. Nothing you type here is uploaded or stored by TapCub.

Share these inputs: the values go after the # in the link, so they never reach a server.

Version v1.0Updated Update history

Read the result

What the results tell you

One color, written six ways, and whether people can read it on your background.

HEX and RGB

The same three 0–255 numbers. HEX writes each one as two base-16 digits: 3B is 3 × 16 + 11 = 59. An 8-digit HEX adds alpha (transparency) at the end.

HSL and HSV

Hue in degrees plus two percentages. HSL is what CSS uses; HSV (also called HSB) is what Photoshop and most color pickers show. They share the hue but not the other two numbers, so do not copy one into the other.

CMYK

A rough print equivalent using the simple formula from CSS Color 5. Real print color depends on the press, paper and ICC profile, so ask your printer for the official CMYK; do not convert it back and expect the same HEX.

Contrast

WCAG compares the relative luminance of two colors, from 1:1 (identical) to 21:1 (black on white). 4.5:1 is the AA minimum for body text, 3:1 for large text and icons. A pair that fails gets a suggested shade.

Numbers can differ by one from other tools. This tool rounds RGB to whole numbers first and derives every other format from that, so pasting any row back gives the same HEX.

How to use it

Three steps

Results update as you type.

  1. 1

    Enter the color

    Paste the value from your brand guide, CSS or design file, or click the swatch to pick one. Format is detected automatically.

  2. 2

    Set the background

    Usually white or your page background. For a button, the background is the button color and the text color goes in the first field.

  3. 3

    Copy and check

    Copy the format you need from the table or the CSS block. If AA fails, try the suggested shade and check again.

Formulas

How the conversions are calculated

Everything follows the W3C CSS Color specifications and WCAG 2.2. Values were checked against culori, an independent color library.

  • HEX ↔ RGB: each pair of hex digits is one channel, value = 16 × first + second
  • HSL and HSV: the standard conversions in CSS Color 4 §7; hue is the angle on the color wheel
  • CMYK: K = 1 − max(R, G, B), C = (1 − R − K) / (1 − K), same for M and Y (CSS Color 5 naive conversion)
  • OKLCH: sRGB is linearised, converted to OKLab with Björn Ottosson's matrices, then C = √(a² + b²) and h = atan2(b, a)
  • Contrast: (L1 + 0.05) / (L2 + 0.05), where L is relative luminance 0.2126 R + 0.7152 G + 0.0722 B on linearised channels
WCAG 2.2 contrast minimums
WhatAAAAA
Body text4.5:17:1
Large text (24 px, or 18.66 px bold)3:14.5:1
Icons, borders, focus rings, form controls (1.4.11)3:1—
Logos and disabled controlsNo requirementNo requirement
Worked example

#3B6BFF by hand

The sample color, converted and checked step by step.

Converting #3B6BFF and checking white text on it
StepWorkingResult
Split the HEX3B · 6B · FF3 × 16 + 11 = 59, 6 × 16 + 11 = 107, 15 × 16 + 15 = 255
RGB—rgb(59, 107, 255)
Linearise(59 / 255 + 0.055) / 1.055, raised to 2.4, and so on0.0437, 0.1470, 1.0000
Relative luminance0.2126 × 0.0437 + 0.7152 × 0.1470 + 0.0722 × 10.1867
Contrast with white(1 + 0.05) / (0.1867 + 0.05)4.43:1: passes for large text and icons, fails AA for body text
Suggested shadeLower OKLCH lightness until the ratio reaches 4.5:1#3A6AFD, 4.50:1

The difference between #3B6BFF and #3A6AFD is hard to see, but it moves white text from failing to passing AA. For a button label at 16 px, either darken the color this way or make the label large and bold.

Common mistakes

Where color values go wrong

Most mix-ups come from formats that look alike.

Pasting HSV into HSL

A picker shows HSB 225°, 77%, 100%; the CSS equivalent is hsl(225 100% 62%). Same hue, very different numbers.

Treating CMYK as exact

Screen-to-print conversion depends on the ICC profile. Use this CMYK as a starting point and get the official value from the printer or brand guide.

Checking contrast by eye

Mid-tone blues, oranges and greens often look readable with white text and still fall below 4.5:1. Measure every text and background pair.

Forgetting transparency

A semi-transparent color looks different on every background. Contrast must be checked on the blended color, which this tool does for you.

FAQ

Color converter questions

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

How do I convert HEX to RGB?

Split the six digits into three pairs and convert each from base 16: #3B6BFF → 3B = 59, 6B = 107, FF = 255, so rgb(59, 107, 255). A three-digit HEX doubles each digit first: #F60 is #FF6600.

How do I convert RGB to HEX?

Write each 0–255 number as two hex digits and join them: 59 → 3B, 107 → 6B, 255 → FF, giving #3B6BFF. Type the three numbers into the color field, even without rgb(), and the HEX appears at the top of the table.

What is an 8-digit HEX color?

The last two digits are alpha (opacity): #3B6BFF80 is the same blue at about 50% opacity. Browsers support it in CSS; some older tools and email clients do not, so use rgba() there.

Is the CMYK value accurate?

It is an approximation. Converting screen color to ink properly needs the ICC profile of the press and paper, which a formula cannot know. Use it for rough work and get the official CMYK from your printer or brand guidelines.

What is OKLCH and why use it?

OKLCH describes color as lightness, chroma and hue in the OKLab space, which tracks how people perceive lightness far better than HSL. Changing L in OKLCH makes a color lighter or darker without shifting its hue, which is why design systems use it for palettes. All current major browsers support oklch() in CSS.

What contrast ratio do I need?

WCAG 2.2 level AA needs 4.5:1 for normal text and 3:1 for large text (24 px, or 18.66 px bold) and for icons and form controls. AAA needs 7:1 and 4.5:1. Logos and disabled controls are exempt.

Why does another converter show a slightly different number?

Rounding. This tool rounds RGB to whole numbers first and calculates HSL, OKLCH and the rest from that, so every row describes the exact HEX you copy. Tools that keep the unrounded value can differ by 0.1–1 in the last digit.

Changelog

Update history

New features, fixes and data refreshes for this tool, newest first.

  1. · v1.0

    LaunchedFirst release.

Missing something or found an error? Tell us — requests that come up often go into the next update. All tool updates

Next step

A chat widget that matches your site

Add TapCub live chat, set your brand color and logo, and talk to visitors with their page and source on screen.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics