Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

HEX to Tailwind Color Converter

Turn any colour into the nearest Tailwind class, or see how to keep it exact.

Design No upload Works offline Free preview, no sign-upIncluded in your pass Pro tool Pro pass: ₹179 for 30 days

Try before you buy.

  • Free preview: how close the nearest Tailwind colour is, the exact alternatives and the first rows of each list, with the closest class, its colour and every match hidden.
  • Locked until you unlock it: download and copy.
  • Unlock: Pro pass, ₹179 for 30 days, a one-time payment that never renews.

Ways to unlock shows how to get the full result.

See passes (opens in a new tab)

Printing this result is locked in the free preview.

Your colour

Try:

HEX with or without # (also with alpha), rgb(), hsl(), oklch() or a CSS name, with an optional name before or after it. Up to 100 colours.

Tailwind version

Tailwind added these four greys in v4.2; untick them for a project on v4.0 or v4.1.

Closest Tailwind colour

Closest Tailwind colour —

Exact alternatives

When no Tailwind colour is close enough, keep your exact colour:

Arbitrary value
 
Theme colour
 

Next steps

About the HEX to Tailwind Color Converter

Find the Tailwind CSS colour that is closest to yours. Type or pick a colour — HEX, rgb(), hsl(), oklch() or a CSS name — and get the nearest default Tailwind colour as a ready class such as bg-sky-700 or text-orange-500, how far off it is, and the next nearest shades. Choose v4, whose palette is defined in OKLCH, or v3, whose palette is in HEX: the two differ, so the closest class can too.

Matches are ranked by ΔE OK, the distance in the OKLab colour space, which follows how different colours look rather than how far apart their RGB numbers are. Paste a whole palette, one colour per line, to map every colour at once. When nothing is close enough, the page gives the exact alternatives: an arbitrary value such as bg-[#1d5fcb], or your colour as a theme colour of its own. Palette values come from the published Tailwind CSS packages (MIT licence).

How to use it

  1. Type or paste a colour into the box, or pick one with the colour picker. For a palette, put one colour per line, with an optional name (Primary #2f6fde).
  2. Choose v4 (OKLCH) or v3 (HEX) for the Tailwind version you use (on v4.0 or v4.1, untick the four greys added in v4.2), and the utility the class is for (bg-, text-, border-, fill- …).
  3. Read the closest class and its ΔE OK: up to 0.02 the two look the same, up to 0.05 they are close, further apart the difference shows. The table lists the next nearest colours and how each one differs (lighter, more muted, hue shift).
  4. For a palette, the list shows every colour’s match; Details opens the matches of one of them.
  5. If no Tailwind colour is close enough, use one of the exact alternatives. With a Pro pass, Copy class, Copy all classes and CSV export the matches; in the free preview they are locked.

Examples

A brand blue
Input
#1d5fcb
Result
v3: blue-700 (ΔE OK 0.045, close) · v4: sky-700 (ΔE OK 0.067), with blue-700 next at 0.068 — noticeably different, so an exact value may be better.

The v4 palette was redrawn in OKLCH, which is why the nearest class changes between versions.

A v3 colour in a v4 project
Input
#f97316 (v3 orange-500)
Result
v4: orange-500, ΔE OK 0.026 — close: v4’s orange-500 is a little more vivid.
A grey
Input
#6b7280
Result
v4: gray-500, ΔE OK 0.004 — visually the same; zinc-500 is next at 0.010.

Common uses

  • Moving a design from Figma or a brand guide, given as HEX values, into Tailwind classes.
  • Replacing hard-coded colours in an old stylesheet with the nearest Tailwind utilities.
  • Upgrading a project from Tailwind v3 to v4 and checking which v4 shades replace the old ones.
  • Deciding whether a colour is close enough to a default shade or deserves a theme colour of its own.

How the closest colour is chosen

Your colour and every default Tailwind colour are converted to OKLab (Björn Ottosson’s perceptual colour space), and the distance between them, ΔE OK, is the straight-line distance in that space. Equal distances look about equally different across hues, which plain RGB distance does not.

CSS Color 4 treats a ΔE OK of 0.02 as one just-noticeable difference. This page calls matches up to 0.02 “visually the same”, up to 0.05 “close” (its own rule of thumb: visible side by side) and further ones “noticeably different”. The difference column says in words how a Tailwind colour differs from yours: lighter or darker, more vivid or more muted, and the hue shift in degrees.

Tailwind v4 and v3 palettes

Tailwind CSS v4 defines its default colours in oklch(), and v4.2 added four grey families (mauve, olive, mist and taupe) to the five it shares with v3 (slate, gray, zinc, neutral, stone). A project on v4.0 or v4.1 has no classes for those four: untick Include mauve, olive, mist and taupe, and the page marks them “v4.2+” wherever they appear. Many v4 colours are more vivid than sRGB can show: on a wide-gamut (Display P3) screen they look as defined, on an sRGB screen the browser shows the nearest colour it can. For those colours the table adds the sRGB value, mapped with the CSS Color 4 gamut-mapping algorithm.

Tailwind v3 defines its colours in HEX, all within sRGB. Choose the version your project uses: the closest class can differ, as the brand-blue example shows.

Translucent colours

A colour with an alpha value (#0f172a80, rgb(15 23 42 / 50%)) gets Tailwind’s opacity modifier: bg-slate-900/50. The alpha is taken to the whole percent; percentages that are not multiples of 5 are written as an arbitrary modifier, /[37%] in v4 and /[.37] in v3. The closest colour is found for the colour itself, without its transparency. A colour that cannot be seen at all (transparent, or an alpha that rounds to 0 %, such as #1d5fcb00) gets Tailwind’s own transparent: bg-transparent.

Keeping a colour exact

  • Arbitrary value: bg-[#1d5fcb] works in v3 and v4 without any configuration.
  • v4 theme colour: add --color-brand: #1d5fcb; inside @theme { … } in your CSS, and classes such as bg-brand and text-brand exist.
  • v3 config colour: add brand: '#1d5fcb' under theme.extend.colors in tailwind.config.js.

The page fills these in for the colour you are looking at, with a name taken from the one you gave it.

Limitations

  • Only Tailwind’s default palette is searched. Colours added in your own theme or by plugins are not known to the page; paste them into the box to compare them yourself.
  • ΔE OK predicts how different two colours look on a screen under typical viewing; it does not account for your monitor, its settings or the colours around them.
  • v4 colours outside sRGB are compared as Tailwind defines them. On an sRGB screen they are shown more muted, so the swatch can look closer or further than the number says.
  • Up to 100 colours are matched at once. In the free preview the closest classes are hidden, the match list and the colour list show their first rows, and copying and the CSV stay locked.

Privacy

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

Frequently asked questions

What do I get without a pass?

Without a pass, HEX to Tailwind Color Converter shows how close the nearest Tailwind colour is, the exact alternatives and the first rows of each list, with the closest class, its colour and every match hidden. Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment that never renews, unlocks the full result. The pricing page lists the passes and their prices.

Which Tailwind version should I pick?

The one your project uses: the version of tailwindcss in your package.json starts with 4 or 3. A v4 project usually loads Tailwind with @import "tailwindcss"; in its CSS; a v3 project usually has a tailwind.config.js. The default colours of the two versions are different, so the closest class can differ. Below v4.2, also untick mauve, olive, mist and taupe, which that version does not have.

What does ΔE OK mean?

It is the distance between two colours in the OKLab colour space. 0 means identical; CSS Color 4 treats 0.02 as one just-noticeable difference; black and white are 1.0 apart.

Why is the closest colour still quite different?

Tailwind’s palette has 11 shades of each of 22 families (v3, and v4 before v4.2) or 26 (v4.2 and later), so some colours fall between them. When the match says “noticeably different”, use the arbitrary value or add your colour to the theme.

Does it work with RGB, HSL or OKLCH colours?

Yes: HEX with or without # (3, 4, 6 or 8 digits), rgb(), hsl(), hwb(), oklch(), oklab(), lab(), lch() and CSS colour names all work.

Is my colour sent anywhere?

No. The palettes are part of the page and every match is worked out in your browser.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.