Ttooleras
🎯

Tailwind CSS Color Finder

Color Tools

Find the nearest Tailwind CSS color from any hex or RGB input and get the exact Tailwind class name (bg-blue-500, text-red-400, etc.).. Free, private — all processing in your browser.

#0203175%
#04052f10%
#06084615%
#080a5e20%
#0b0d7525%
#0d0f8c30%
#0f12a435%
#1114bb40%
#1317d345%
#1519ea50%
#2c30ec55%
#4447ee60%
#5b5ef065%
#7375f270%
#8a8cf475%
#a1a3f780%
#b9baf985%
#d0d1fb90%
#e8e8fd95%
#020317
#060846
#0b0d75
#0f12a4
#1317d3
#2c30ec
#5b5ef0
#8a8cf4
#b9baf9
#e8e8fd
Advertisement

The Tailwind Color Finder takes any hex, RGB, or HSL color and tells you the nearest Tailwind CSS color class. You know the shade you want from a Figma file, a brand guideline, or an existing site, but you need the Tailwind class name to use it in code. Manually scanning Tailwind\u2019s 240+ colors for a visual match is slow and unreliable. This tool computes the perceptual distance in OKLCH or LAB color space and returns the single closest Tailwind color, plus the top 5 alternatives so you can compare options.

Output includes the full Tailwind class prefix for all common utilities — bg-blue-500 for backgrounds, text-blue-500 for text, border-blue-500 for borders, ring-blue-500 for focus rings, divide-blue-500 for dividers. The tool covers the default Tailwind palette (slate, gray, red, orange, yellow, ..., fuchsia, pink, rose × 11 shades each), and toggles let you include/exclude specific color families if you have restricted the palette in your config. Perfect distance match is rare; the tool reports the color distance so you know how close the match actually is. If the distance is large, you probably need to extend Tailwind\u2019s palette with a custom color rather than forcing a poor match.

Tailwind CSS Color Finder — key features

Perceptual distance matching

Uses OKLCH color space for perceptually accurate "nearest color" computation, not naive RGB Euclidean.

Top 5 matches

Returns the single closest plus four runners-up, letting you pick the best visual match from several options.

Full class name generation

Produces Tailwind class names for bg, text, border, ring, divide, fill, and stroke utilities.

Complete default palette

Covers all 22 color families and 11 shades of Tailwind’s default palette.

Family exclusion

Limit matching to specific families if your project uses a restricted palette.

Distance reporting

Shows how close the match actually is so you know whether to accept it or extend the palette.

Multiple input formats

Hex, RGB, HSL, RGBA, or named colors — all parsed automatically.

Client-side only

Brand colors and design tokens stay in your browser.

How to use the Tailwind CSS Color Finder

  1. 1

    Enter your color

    Paste a hex (#FF6B35), RGB (rgb(255,107,53)), HSL, or color name.

  2. 2

    See nearest matches

    The top 5 Tailwind colors appear ranked by perceptual distance, with the closest at top.

  3. 3

    Pick the class utility

    Choose background, text, border, ring, or other utility — the tool shows the full class name.

  4. 4

    Copy the class

    One-click copy sends the Tailwind class to your clipboard, ready to paste into JSX or HTML.

  5. 5

    Check distance

    If the distance is high (>15), consider extending Tailwind with a custom color instead of forcing a poor match.

Common use cases for the Tailwind CSS Color Finder

Design to code

  • Figma to Tailwind: Take a color from a Figma mockup and find the Tailwind class that implements it closest.
  • Brand color audit: Check how close your brand colors are to Tailwind defaults — if close, use defaults; if not, extend.
  • Design system alignment: Verify existing CSS colors map cleanly to Tailwind before refactoring to use utility classes.

Developer workflow

  • Quick class lookup: Know you want "that muted blue" and get the exact Tailwind class without scrolling the palette.
  • Style inspection: Inspect a competitor’s site, grab the brand color, and find the Tailwind equivalent for your own project.
  • Component migration: Port hardcoded CSS colors in an existing codebase to Tailwind classes during a utility-first migration.

Onboarding

  • Learning Tailwind: Newcomers to Tailwind use this tool to bridge the gap between "I know what color I want" and "what class is that".
  • Team communication: Share exact Tailwind class names in code reviews or design discussions rather than approximate descriptions.
  • Code generation: AI or template-based code generation that produces Tailwind can use this tool’s logic for color conversion.

Tailwind CSS Color Finder — examples

Exact match

A Tailwind color found exactly.

Input
#3B82F6
Output
nearest: blue-500 (exact match)
class: bg-blue-500
distance: 0

Close match

Input close to but not exactly a Tailwind color.

Input
#FF6B35
Output
nearest: orange-500 (distance 4.2)
class: bg-orange-500
alternatives: orange-400, red-400, amber-500

Gray family

A specific gray mapped to nearest Tailwind gray.

Input
#5A6270
Output
nearest: gray-500 (distance 3.8)
family: gray
or slate-500 (distance 4.1)

Poor match warning

A color far from any Tailwind preset.

Input
#C2F5B0
Output
nearest: lime-200 (distance 18.7)
warning: distance >15, consider extending palette with custom color

Full utilities

Multiple class names from one color.

Input
nearest: blue-600
Output
bg-blue-600
text-blue-600
border-blue-600
ring-blue-600
fill-blue-600

Technical details

Finding the \"nearest\" color requires defining distance in color space. Naive RGB Euclidean distance (sqrt((r1-r2)^2 + (g1-g2)^2 + (b1-b2)^2)) is fast but does not match human perception — colors that look very different can have small Euclidean distance, and vice versa.

The tool uses OKLCH distance by default, which is perceptually uniform: equal distances in OKLCH correspond to equal perceived differences. LAB is an older perceptual space with similar properties.

The comparison loop:
1. Convert input to OKLCH
2. For each Tailwind color (240 entries in default palette), convert to OKLCH
3. Compute Euclidean distance in OKLCH space
4. Sort ascending and return the top N matches

Computation is instantaneous since the Tailwind palette is small and fits in memory.

The Tailwind palette includes:
- Grays: slate, gray, zinc, neutral, stone (5 grayscale families × 11 shades)
- Reds: red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose (17 chromatic families × 11 shades)

That\u2019s 22 families × 11 shades = 242 colors, plus white, black, and transparent as edge cases.

Each shade is labeled 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950. The 500 shade is typically the \"base\" for each family; 50 is the lightest, 950 the darkest.

The class name format depends on the utility:
- Background: bg-{color}-{shade}
- Text: text-{color}-{shade}
- Border: border-{color}-{shade}
- Ring: ring-{color}-{shade}
- Divide: divide-{color}-{shade}
- Fill (SVG): fill-{color}-{shade}
- Stroke (SVG): stroke-{color}-{shade}

Tailwind v4 adds alpha-inclusive syntax (bg-blue-500/50 for 50% opacity). The tool generates full v3 class names; alpha modifiers are appended manually.

Distance threshold: matches below 5 in OKLCH units are visually very close (most people can\u2019t distinguish). 5-15 is close but perceptible. Above 15 is clearly different — consider extending the palette rather than using the nearest match.

Common problems and solutions

Forcing a poor match

If the distance is large (>15), the nearest Tailwind color looks visibly different from your intended color. Extending Tailwind with a custom color is usually better than compromising your design.

Gray family confusion

Tailwind has 5 grayscale families (slate, gray, zinc, neutral, stone) that differ subtly in tint. The tool matches the closest, but visual preference matters — check all 5 if you’re picky.

Shade steps not perceptually uniform

Tailwind’s default shades were crafted manually and are not exactly mathematically uniform. A color halfway between blue-400 and blue-500 may be equidistant from both; the tool picks one but the choice is essentially arbitrary.

Tailwind v4 palette changes

Tailwind v4 uses OKLCH color space for its default palette, giving slightly different values than v3 hex codes. The tool uses v3 palette by default; switch to v4 mode if you are on the new version.

Custom palette in config

If your tailwind.config.js extends or replaces colors, the tool’s default palette may not match your actual palette. Import your config colors for accurate matching or use the default-palette mode.

Alpha not matched

The tool matches solid colors only. If your input has alpha (transparency), the match is against the solid form. Apply alpha separately with bg-blue-500/50 syntax for transparency.

Arbitrary value often better

For perfect fidelity, Tailwind’s arbitrary value syntax works: bg-[#FF6B35]. Use this when no nearest match is close enough and you don’t want to extend the palette globally.

Tailwind CSS Color Finder — comparisons and alternatives

Compared to visually scanning Tailwind\u2019s default color palette cheatsheet, this tool is instant and accurate. Visual scanning is fine for picking from a small range but fails for matching a specific hex input.

Compared to online Tailwind color pickers that show the palette as swatches, this tool is the reverse — you bring the color, the tool finds the class. Swatch browsers are for discovery; this tool is for matching a known target.

Compared to Tailwind\u2019s built-in IntelliSense in VS Code, this tool gives perceptual nearest-color matching, which IntelliSense does not provide. Use IntelliSense for code completion; use this tool for color-to-class translation.

Frequently asked questions about the Tailwind CSS Color Finder

How does the tool find the nearest Tailwind color?

It converts your input color to OKLCH color space, then computes Euclidean distance to every color in the Tailwind palette (also in OKLCH). The color with smallest distance is the nearest perceptual match. OKLCH is perceptually uniform, so small distances correspond to visually similar colors.

What is a good distance threshold for a usable match?

Distances under 5 in OKLCH are essentially indistinguishable — perfect match for practical purposes. 5-10 is very close, fine for most design work. 10-20 is noticeable but usable if exact match isn’t critical. Above 20 is clearly different — you probably need a custom color.

Does the tool support Tailwind v4?

Yes. v3 is the default; switch to v4 mode if you are using Tailwind v4, which adopted OKLCH-based colors with slightly different hex values for each shade. The class names are the same but the underlying colors differ.

Can I use this with my extended Tailwind config?

Not directly — the tool matches against Tailwind’s default palette. If your config extends or replaces colors, you’d need to add those colors to the matcher (or manually check your custom palette against the nearest match).

What if no Tailwind color is close enough?

You have two options: extend Tailwind with a custom color in tailwind.config.js, or use Tailwind’s arbitrary value syntax like bg-[#FF6B35] for that specific element. Custom palette is better for recurring colors; arbitrary values are better for one-off use.

Which class utilities does the tool generate?

bg-, text-, border-, ring-, divide-, fill-, and stroke- prefixes. Pick the one you need. For other utilities (outline, shadow), the color name (blue-500) is the same — just change the prefix.

Does this work for the exact Tailwind defaults or for my custom ones?

Default Tailwind palette only, unless your config matches the defaults. If you extended colors.primary or changed the palette, results won’t reflect those customizations. Use the config import feature (when available) for custom palette matching.

Is the color data sent to a server?

No. Matching runs in your browser with the Tailwind palette loaded as static data. No network requests for the matching itself.

Additional resources

Advertisement

Related tools

All Color Tools

Learn more

Explore more tools

200+ free tools that run in your browser.

Browse all tools →