Tailwind Color Matcher
Find the nearest Tailwind shade for any hex color, with transparent distance scores.
Color & settings
#1D4ED8Lower values show only near-exact shades. Tailwind CSS v3.x default palette.
Paste a JSON object such as { "brand": { "500": "#123456" } }.
Matches
10 shadesbg-blue-700 exact
#1D4ED8 · Δ 0.00 · RGB +0/+0/+0
Examples
Exact palette color
#1D4ED8bg-blue-700 · #1D4ED8 · Δ 0.00 · exact badgeEvery palette shade maps to itself, which also serves as a built-in correctness check.
Between two families
rgb(20, 120, 190)Ten closest shades with per-channel deltas and scoresThe ranking exposes how close the alternatives are instead of picking a hidden winner.
Design-system migration
Batch: #1D4ED8 / #EF4444 / #22C55E| Input | Tailwind class | Hex | Score |Export the table straight into a migration PR description or a spreadsheet.
About this tool
Tailwind Color Matcher answers a narrow, frequent question: which default Tailwind class is closest to this hex? It converts the input to OKLab, compares it against all 242 colors in the Tailwind CSS v3 default palette and ranks the ten nearest shades with distance scores and per-channel deltas. A zero score means the input is exactly a palette color.
OKLab is the default because distances in that space track perceived difference better than raw RGB geometry; a Redmean weighted-RGB metric is available for comparison. A threshold slider hides weaker matches, the family strip shows all eleven shades of the winning hue, and prefix controls emit text-, bg-, border-, ring- or from- classes.
For migration work, the batch tab maps a newline-separated list of colors to classes and exports Markdown or CSV. Projects with a modified config can paste a custom palette JSON in the same family-to-shade shape used by Tailwind. All lookups are local and stateless; no color or palette is uploaded.
What this tool does not do
- Only the Tailwind v3.x default palette is bundled; other versions need a pasted custom palette.
- Alpha channels are ignored during matching and are not emitted in class names.
- OKLab is an approximation of perception, not a color-appearance model or an accessibility certification.
- Batch mode accepts one color per line rather than arbitrary delimiters.
How to use this tool
Enter a color
Type a hex value, use the color picker, or paste rgb()/hsl() syntax. Matching updates as you type.
Choose a metric
Keep OKLab for perceptual ranking or switch to Redmean weighted RGB. Adjust the score threshold to hide distant shades.
Inspect and copy
Click a ranked row to make it primary, check the RGB deltas, then copy the class with your chosen prefix.
Batch or customize
Use the Batch tab for a list of hexes, or paste a custom palette JSON to match against your own theme.
Use cases
Design-to-code
Turn a mockup's arbitrary hex values into default Tailwind classes without guessing the shade.
Palette learning
Explore all eleven shades of a family and see which ones are perceptually closest to a target color.
Theme migration
Batch-map legacy brand colors to Tailwind classes and keep the scores as a review aid.
Inputs and outputs
| Item | Accepted form |
|---|---|
| Single color | #rgb, #rgba, #rrggbb, #rrggbbaa, rgb()/rgba(), hsl()/hsla() |
| Palette | Tailwind v3 defaults (242 shades) or JSON { family: { shade: hex } } |
| Class output | bg-, text-, border-, ring- or from- followed by family-shade |
| Batch export | Markdown table or CSV with input, class, hex, score and error |
Alpha channels are ignored for matching: #1D4ED8FF and #1D4ED8 map identically.
Common mistakes
Mistake:Expecting a custom theme to be created.
Fix:This tool only finds the nearest existing shade; use a theme builder to define new scales.
Mistake:Comparing scores across metrics.
Fix:OKLab and Redmean scores use different scales; compare rankings within one metric, not absolute values between them.
Mistake:Assuming Tailwind v4 colors are identical.
Fix:The bundled palette is Tailwind v3.x default; paste your v4 or custom palette JSON for an exact match.
Mistake:Pasting a whole CSV into the single-color field.
Fix:Use the Batch tab, which expects one color per line and reports invalid rows individually.
Frequently asked questions
How is "closest" calculated?
By default the input is converted to OKLab, a perceptually smoother color space, and ranked by Euclidean distance to all 242 default shades. Redmean weighted RGB distance is available as an alternative. A score of 0 means an exact palette color.
Which Tailwind palette version is used?
The bundled data is the Tailwind CSS v3.x default palette: 22 families with 11 shades each. Tailwind v4 changed some values, so paste your own palette JSON if your project uses a different set.
Can I match a custom or modified palette?
Yes. Paste JSON shaped like {"brand": {"500": "#123456"}} into the custom palette field. The same ranking, family strip and batch export then run against your colors instead of the defaults.
Why do some colors have two close matches?
Hue families overlap around their boundaries — teal and cyan, for example. The ranked list shows the top ten with scores and per-channel deltas so you can decide whether the second family is a better semantic fit.
Can I batch-convert a list?
Yes. Put one color per line in the Batch tab. Each row maps to its best class, invalid lines are reported individually, and the result exports as a Markdown table or CSV.
Does it handle 3-digit and alpha hex values?
Yes. #abc expands to #AABBCC, and an 8-digit value such as #1D4ED8FF is matched on its RGB portion; alpha is ignored because Tailwind utility classes do not encode it.
References & standards
Related tools
CIELAB Color Explorer
Convert colors to CIELAB/LCh and XYZ, explore a*–b* and L*–C* slices, and compare colors with ΔE76 and ΔE2000.
CMYK Color Converter
Convert hex/RGB to CMYK percentages and back with total ink limits, rich-black recipes, batch conversion and a print preview.
Color Blindness Simulator
Simulate color blindness on palettes and images. Compare protanopia, deuteranopia, tritanopia, and more side-by-side.
Color Contrast Checker
Advanced WCAG accessibility compliance checker with color blindness simulation, multiple text sizes, and comprehensive analysis features.
Color Converter
Convert colors between multiple formats (HEX, RGB, HSL, HSV, CMYK, LAB) with color blindness simulation, named colors, and batch processing
Color Extractor
Extract colors from uploaded images by hovering over pixels to get precise color values.