Nearest Tailwind colour — match any HEX to a Tailwind class

Enter any colour and choose Tailwind v3 or v4, and the tool names the closest default palette class, says whether it is exact, and lists the next nearest classes with their distances.

Live demo · real result from this tool
Tailwind version
Nearest classsky-600
Its HEX
#0284c7
Exact match
No
Difference (ΔE OK)
0.0414
Utility examples
bg-sky-600 text-sky-600

Colours

Table

ClassHEXΔE OK
sky-600#0284c70.0414
blue-500#3b82f60.0513
blue-600#2563eb0.0759
indigo-500#6366f10.0794
cyan-600#0891b20.0929
sky-700#0369a10.0987

Processed on your device — nothing is uploaded.

How to use the nearest Tailwind colour finder

  1. Enter your Colour as HEX, rgb(), hsl(), oklch() or a CSS name.
  2. Choose the Tailwind version: v3 (the default here) or v4.
  3. Read the Nearest class, its HEX, whether it is an Exact match, and the Difference (ΔE OK).
  4. Copy the utility examples, such as bg-sky-600 text-sky-600.
  5. Look at the swatches and the table of six closest classes if the first match is not quite right.

What it does and when to use it

Designs often arrive with HEX codes that are almost, but not quite, Tailwind colours. Converting them by eye means scrolling through 242 or more swatches. This tool does the comparison for you and tells you how far off the nearest class is, so you can decide whether to use the class or add a custom colour.

It is useful when you port a mock-up to Tailwind, clean up arbitrary values such as bg-[#3a7bd5] in an existing project, or check whether a colour from a screenshot was a stock Tailwind shade. To browse the full palette instead, open the Tailwind colour palette. For a matching CSS keyword, use the colour name finder, and for a precise ΔE2000 between your colour and the match, the colour distance calculator.

How it works

Your colour and every shade of the chosen palette are converted to OKLab. The distance is ΔE OK = √(ΔL² + Δa² + Δb²). Shades are sorted by distance and the six nearest are listed; a distance under 0.0005 counts as exact.

The v3 palette uses Tailwind 3.4.17’s HEX values. The v4 palette uses Tailwind 4.3.3’s OKLCH values converted to sRGB with CSS Color 4 gamut mapping, so very vivid v4 shades are compared as they appear on a standard screen.

Worked examples

These are the tool’s own results.

#3b82f6, v3. Nearest class: blue-500, Exact match: Yes, ΔE OK 0. Next are indigo-500 (0.0718) and sky-600 (0.0787).

#3a7bd5, v3. Nearest class: sky-600 (#0284c7), ΔE OK 0.0414. blue-500 is close behind at 0.0513, so try both.

#3a7bd5, v4. Nearest: sky-600, now #0084d1, at ΔE OK 0.0325, followed by blue-500 (#2b7fff) at 0.0629.

Limits and tips

  • A nearest match can still look different. Check the swatch row before you replace a colour.
  • Transparency is ignored; compare the solid colour.
  • Matching runs in your browser.

Frequently asked questions

How is "nearest" measured?
By ΔE OK, the straight-line distance between two colours in the OKLab colour space, which is designed so that equal distances look roughly equally different. The class with the smallest distance wins.
How close is a good match?
A ΔE OK of 0 is exact. As a guide, values around 0.02 or below are hard to tell apart side by side, which is the same threshold CSS uses for gamut mapping. At 0.04 or more you will usually see a difference.
Why might v3 and v4 give different classes?
The palettes are different. v4 redefined every colour in OKLCH, and some moved noticeably.
Should I use the class or my own colour?
If the match is close and you want to stay on the default palette, use the class; it keeps your design consistent with the rest of Tailwind. If the colour is a brand requirement, add it to your theme as a custom colour instead.
Are custom theme colours included?
No. Only the default Tailwind palette for the version you pick is searched.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close