How the matching works
Your colour and all of Tailwind’s colours are converted to OKLab, and the distance between them is measured there. OKLab is designed so that the same distance looks like the same amount of difference, whatever the hue. That gives better matches than comparing hex or RGB values, which treat a small change in a dark blue the same as a small change in a pale yellow, even though you’d see one far more easily.
| ΔE | Label | What it means |
|---|---|---|
| under 0.3 | Exact match | The same colour, give or take rounding |
| 0.3 to 1 | Looks identical | Safe to swap in |
| 1 to 3 | Very close | You might notice side by side |
| 3 to 6 | Noticeably different | Fine for a mock-up, not for a brand colour |
| over 6 | Not close | Use the arbitrary value instead |
Tailwind v4 and v3 palettes
Tailwind v4 defines every colour in OKLCH, for example --color-blue-500: oklch(62.3% 0.214 259.815). Many of the new colours are slightly outside sRGB, the range most screens have shown for years, so on a wide-gamut screen they look more vivid. Where that happens, the tool also shows the nearest sRGB hex. v4 also adds mauve, olive, mist and taupe neutrals.
Tailwind v3 uses hex values, so a v3 colour pasted in with v3 selected always matches exactly. Moving a project from v3 to v4? Paste the old hex with v4 selected to see which shade it lands on now.
Transparent colours
If your colour has alpha, like #3b82f680 or rgb(59 130 246 / 50%), it’s matched at full opacity and the class gets an opacity modifier: bg-blue-500/50. v4 accepts any whole percentage. v3’s default scale goes in steps of 5, so other values are written as /[0.37].
Using the class
<!-- the nearest palette colour -->
<button class="bg-sky-500 text-white">Save</button>
<!-- the exact colour, no config needed -->
<button class="bg-[#1d9bf0] text-white">Save</button>
/* v4: add it to your theme once, then use bg-brand */
@theme {
--color-brand: #1d9bf0;
}Need the colour in another format? The colour converter gives HSL, OKLCH and more, and the contrast checker tells you whether text on it is readable.
Questions people ask
How do I find the closest Tailwind colour to a hex code?
What does ΔE mean?
Why is #3b82f6 not an exact match for blue-500 any more?
#3b82f6 is v3’s blue-500 exactly; in v4 it’s still closest to blue-500, but not identical. Switch to v3 to match the old palette.What if no Tailwind colour is close enough?
bg-[#1d9bf0], which works without any config. If you’ll use the colour often, add it to your theme: @theme { --color-brand: #1d9bf0; } in v4, or theme.extend.colors in v3, then write bg-brand.Can I look up what a Tailwind class is?
text-slate-700, hover:bg-sky-500/50 or var(--color-blue-500) to see its exact value, its hex and RGB, and the shades next to it.