piapia123
en

Tailwind Colour Converter

Styling

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Convert between Tailwind class names and colour values: `bg-blue-500` and `text-red-600` become `#3b82f6`, `rgb(59 130 246)` or `hsl(217 91% 60%)`, and a hex value can be matched back to the nearest palette name. The built-in palette is the Tailwind CSS v3 default: 22 colour families × 11 shades (50–950) plus black and white, 244 values in all. “Nearest” uses a channel-by-channel distance (redmean weighted), not a comparison of hex strings — the latter would treat `#3b82f6` and `#3b82f7` as unrelated. Several values can be converted at once, each with its distance. Everything runs locally.

Features

  • Tailwind class name to hex / rgb / hsl
  • hex, rgb() and hsl() to a value and the nearest Tailwind name
  • Built-in v3 default palette: 22 families × 11 shades plus black and white, 244 values
  • Class names may keep a utility prefix (bg-, text-, border-t- …) and an opacity suffix such as /50
  • Nearest colour by redmean-weighted RGB distance, with the distance shown
  • Accepts 3-digit hex (#abc) and rgb/rgba, hsl/hsla
  • A colour swatch is drawn in front of each value
  • Convert several lines at once and copy them one by one

How to use

  1. Type one colour value or Tailwind class per line
  2. Pick the output format (hex, rgb, hsl, Tailwind, or all)
  3. The conversion and the nearest name appear at once
  4. Use the copy button on a row to take just that value

FAQ

How is the “nearest” colour worked out?
With a redmean-weighted RGB distance: the difference is taken on each of the three channels, then weighted by the mean of the red channel. It is far more sensible than comparing hex strings (which would treat two blues differing by one digit as unrelated) and closer to human perception than a plain Euclidean distance in RGB (the eye is most sensitive to green and least to blue). It is not a colour-management-grade CIEDE2000, but it is more than enough to pick the nearest of 244 candidates.
Why is there no matching class for some colours?
Because the built-in palette is the Tailwind default and does not include colours you defined yourself. If you changed the palette in `tailwind.config`, the nearest name reflects the default only — but it still tells you roughly which family and shade the colour falls into.
Which colour notations are accepted?
Hex (3 or 6 digits, with or without the leading `#`), `rgb()` / `rgba()`, `hsl()` / `hsla()`, and Tailwind class names. Both space-separated and comma-separated forms are recognised.
Is anything uploaded?
No. The palette and the conversions all run in the browser and the page makes no requests.

Related tools