Tailwind Colour Converter
StylingEverything runs locally in your browser — nothing is uploaded
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
- Type one colour value or Tailwind class per line
- Pick the output format (hex, rgb, hsl, Tailwind, or all)
- The conversion and the nearest name appear at once
- 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
Color Converter
ConvertConvert between HEX, RGB, HSL, HWB, CMYK, Lab and OKLCH, with colour temperature, inverse, complement, nearest ANSI colour and WCAG contrast.
CSS Colour Names
LookupsThe 148 CSS named colours: look up a value from a name, or find out whether a value has a standard name. Includes the nine same-colour pairs.
Colour Schemes
LookupsEnter a base colour and get seven harmonies — monochromatic, analogous, complementary, split, triadic, tetradic, neutral — each with when to use it.
CSS Gradient Generator
StylingAdjust the angle, colours and shape, preview the gradient live, copy the CSS. Linear, radial and conic, with an optional middle stop.
CSS Border Radius
StylingSet each corner radius, preview it live and copy the CSS. px, rem or percent — and the preview shows why a percentage gives an ellipse.
Glassmorphism Generator
StylingAdjust blur, opacity, saturation and border, preview the glassmorphism live and copy the CSS, -webkit- prefix included so it works on iOS.