Tailwind color generator

Enter one color and get a full scale of lighter and darker shades on the same curve as Tailwind CSS's own palette, with HEX, OKLCH and contrast for each.

Scale

StopColorHEXOKLCHOn whiteOn black

Export


  

How to use the Tailwind color generator

  1. Type your Base color in any format, such as #4f46e5, rgb(79, 70, 229), oklch(51% 0.23 277) or teal, or click the swatch to use your system color picker.
  2. Give it a Color name, such as brand or primary. It becomes part of each class name and variable, so brand gives bg-brand-500.
  3. Choose the Scale: 11 Tailwind-style stops from 50 to 950, or a 12-step UI scale. For the 50–950 scale, choose whether your color goes at the stop with the closest lightness or always at 500.
  4. Check the table: HEX, OKLCH and the contrast ratio of every stop against white and black, with a pass mark where it meets WCAG AA for normal text (4.5:1).
  5. Pick an export format (Tailwind v4 @theme, a v3 tailwind.config.js object, CSS variables or JSON), choose OKLCH or HEX values, and click Copy code. Copy link to these settings copies a URL that opens the same scale.

What it does

Tailwind CSS names each color's shades 50, 100, 200 and so on up to 900 and 950, from lightest to darkest. This generator builds the same kind of scale from one color of your own, so it fits beside the built-in colors in a Tailwind project. Nothing about the output is Tailwind-only: the CSS variables and JSON exports work as a general color shades generator for any design system.

How the scale is built

The generator works in OKLCH, which describes a color by lightness, chroma (how colorful it is) and hue. Equal steps in OKLCH lightness look roughly equal to the eye, which makes it a good space for building even scales.

  1. Target lightness for each stop. We took the 17 chromatic families of the Tailwind CSS v4 default palette (red to rose, leaving out the grays) and used the median lightness at each stop.
  2. Chroma profile. For each of those families we divided each stop's chroma by the family's highest chroma, then took the median at each stop. Colors are most saturated around 500 and 600 and fade toward both ends.
  3. Your color sets the level. Your color's chroma and its position on that profile give a peak chroma for the whole scale, and every stop is generated at your color's hue (very pale tints can drift a few degrees after rounding to HEX).
  4. Your color stays exact. It goes at the stop whose target lightness is closest to its own (or at 500 if you choose), and that stop is your input unchanged.
  5. Every stop fits on screen. A stop that would fall outside sRGB is brought inside with the CSS Color 4 gamut mapping method, which keeps lightness and hue and lowers only chroma.
StopTarget lightnessChroma (share of peak)
5097.7%7%
10095.1%15%
20090.2%34%
30083.3%58%
40074.6%82%
50068.5%96%
60059.2%99%
70051.4%86%
80044.8%72%
90039.6%55%
95027.9%37%

When you choose Always 500, the lightness curve is stretched so 500 lands on your color and the other stops spread evenly toward white and black. A very light or very dark color at 500 crowds the stops on one side; the tool tells you when that happens.

Worked example

Start with #4f46e5, which is oklch(51.06% 0.2301 276.97). Its lightness, 51.06%, is closest to the 700 target of 51.4%, so it becomes brand-700. The tool then gives 50 #f4f7ff, 100 #e7edff, 200 #d2dbff, 300 #b7c2ff, 400 #95a1ff, 500 #7f89ff, 600 #625dff, 800 #413cbb, 900 #373794 and 950 #1e1f58.

Brand-700 has a contrast ratio of 6.29:1 on white, so it passes AA for normal text, and 3.34:1 on black, which does not. Brand-600 (#625dff) is 4.64:1 on white and 4.53:1 on black, just passing on both. With Always 500 the same color becomes brand-500, and 400 moves to #6765ff and 600 to #423dbe.

The 12-step UI scale

Some design systems number their steps by job instead of by lightness. Radix Colors popularized a 12-step model in which each step has a use. This tool follows the same 12 uses with its own lightness targets:

StepUseTarget lightness
1App background99.0%
2Subtle background97.5%
3Component background95.0%
4Hovered component92.5%
5Pressed component89.5%
6Subtle border86.0%
7Border81.0%
8Strong border74.5%
9SolidYour color
10Hovered solidYour color, 4.5 points darker
11Low-contrast text50.0%
12High-contrast text27.0%

Steps 1 to 8 are light tints for backgrounds and borders. Step 9 is your color unchanged, and step 10 is 4.5 lightness points darker for its hover state (lighter instead if your color is very dark). Steps 11 and 12 are text colors: we checked every hue at three chroma levels, and step 11 always has at least 4.5:1 contrast on step 2 and step 12 at least 7:1. For #4f46e5, steps 1 to 4 are #fafbff, #f3f6ff, #e7edff and #dce4ff, and step 12 is #1d1e54.

Using the export

In Tailwind CSS v4, paste the @theme block after @import "tailwindcss"; in your main CSS file; it creates bg-brand-500, text-brand-700 and the rest, plus variables such as var(--color-brand-500). In v3, merge the object into theme.extend.colors in tailwind.config.js. The CSS variables export gives plain custom properties such as --brand-500 for projects without Tailwind.

Common mistakes

Tailwind CSS is made by Tailwind Labs. Dev Kit Bag is not affiliated with or endorsed by Tailwind Labs.

Key terms

Color scale
A set of related colors that run in order from light to dark, usually with one hue. Tailwind CSS numbers its scales 50 to 950, and many design systems use a scale for backgrounds, borders and text so that colors stay consistent.
Tint
A lighter version of a color, traditionally made by mixing it with white. The lighter steps of a color scale, such as Tailwind's 50 to 300, are also loosely called tints.
Shade
A darker version of a color, traditionally made by mixing it with black. In everyday use, "shade" often means any step of a color scale, lighter or darker.
Base color
The color a scale is built from, such as a brand color. In this tool it is kept unchanged at one stop, and the other stops are generated around it.
Chroma
How colorful a color is compared with a gray of the same lightness. In OKLCH, 0 is a neutral gray and higher numbers are more saturated. The highest chroma a screen can show depends on the hue, the lightness and the gamut of the display.
12-step color scale
A scale in which each of 12 steps has a set job, such as app background, border, solid fill or text, rather than just a lightness. It was popularized by Radix Colors.
Gamut mapping
Turning a color that is outside a gamut into the closest color inside it. CSS Color 4's gamut mapping algorithm keeps lightness and hue and lowering chroma until the result is within a just-noticeable difference of a color the screen can show; the final clip can shift the hue slightly.

Frequently asked questions

Will my exact color appear in the scale?
It does. The stop it is placed at is your input, unchanged; only the other stops are generated.
Which stop should my brand color be?
Let the tool choose the stop with the closest lightness, so the scale stays even. Choose Always 500 if your code already uses brand-500 as the main color.
Should I export OKLCH or HEX?
Tailwind CSS v4 uses OKLCH for its own colors, and every current major browser supports it. Choose HEX for v3 projects, older browsers or tools that do not read OKLCH; the colors are the same, because every stop is inside sRGB.
Can I use this without Tailwind?
The CSS variables and JSON exports are plain color values with no Tailwind syntax, so they work in any stylesheet, design token file or app.
Why are some stops less saturated than my color?
Very light and very dark colors cannot hold much chroma on an sRGB screen. Those stops are reduced to the most colorful version that still fits, keeping lightness and hue.
How is the 12-step scale different?
Its steps are chosen by use (backgrounds, borders, solid color and text) instead of by an even lightness curve, and your color is always step 9.
Where is the scale calculated?
In your browser, with JavaScript on this page. Your settings are kept in the page address and in your browser's storage, so a copied link and your next visit open the same scale.

Sources: Tailwind CSS colors, CSS Color 4 gamut mapping, WCAG 2.2 contrast (minimum), Radix Colors: understanding the scale. Last checked 2026-11-17.