Tailwind color generator
Enter one hex code and get a 50 to 950 scale with the code for Tailwind v4, v3, CSS variables or JSON. Your color stays exactly as you typed it.
Scale (click a step to copy its hex)
What is a Tailwind color scale?
Tailwind names the shades of each color with eleven steps: 50 is the lightest, 500 is the middle, and 950 is the darkest. A full scale lets you pick a tint for a background, a mid tone for a button and a dark shade for text, all from the same hue. This page builds that scale for any color you enter.
How the scale is built
The generator works in OKLCH, a color space where lightness, chroma (how vivid the color is) and hue are separate. It follows four rules:
- Each step has a target lightness, from 97.5% at step 50 down to 25% at step 950.
- Your color goes on the step with the closest lightness and stays exactly as entered.
- The other steps keep your hue. Their lightness is spread between your color and the ends of the scale.
- Chroma follows a curve: full at the middle and lower toward white and black, then trimmed to what a screen can display.
For the house color #00FF49 the result is below. It lands on step 200.
| 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950 |
|---|---|---|---|---|---|---|---|---|---|---|
#E6FFE6 | #BBFFBC | #00FF49 | #00E541 | #00C135 | #00A12B | #008321 | #006919 | #005311 | #00410C | #002B05 |
For a mid blue, #3B82F6, it lands on step 500:
| 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950 |
|---|---|---|---|---|---|---|---|---|---|---|
#F2F7FF | #E2EDFF | #C5DCFF | #A0C5FF | #6AA2FF | #3B82F6 | #2166D5 | #1250B1 | #0D3F8D | #0E326C | #11213C |
Which steps work for text?
For #00FF49, white text passes the WCAG AA threshold of 4.5:1 on steps 600, 700, 800, 900, 950. The tool shows the best text color and ratio on every step for the color you enter, so you do not need to work it out by hand. See the contrast checker for any other pair.
How to use the code
Tailwind v4. Paste the @theme block into your main CSS file. Tailwind turns each --color-name-step variable into utilities such as bg-brand-500, text-brand-700 and border-brand-200.
Tailwind v3. Paste the object into theme.extend.colors in your config file.
Plain CSS. The CSS variables format gives you --name-500 style custom properties for any project.
Frequently asked questions
How do I make a Tailwind color palette from one hex code?
Paste the hex code above. The generator builds eleven steps (50, 100, 200 and so on up to 950) and shows code you can paste into Tailwind v4, Tailwind v3, plain CSS or JSON. Your color stays in the scale exactly as you entered it.
How do I add a custom color to Tailwind CSS v4?
Tailwind v4 reads colors from CSS. Paste the @theme block into your stylesheet and the classes work straight away, for example bg-brand-500 and text-brand-900. No config file is needed.
How do I add a custom color to Tailwind CSS v3?
Choose Tailwind v3 and paste the object into theme.extend.colors in tailwind.config.js. The key becomes the class name, so a color named brand gives bg-brand-500.
Are these the same as the built-in Tailwind colors?
No. Tailwind's own palette was designed by hand, and you can see it on the Tailwind colors chart. This tool builds a scale for your color with the same step names and a similar spread of lightness, so it slots in beside the built-in ones. The values will not match Tailwind's exactly.
Which steps are safe for text?
It depends on the color, so each step shows its best text color and contrast ratio. As a rule of thumb the light steps (50 to 300) take dark text and the dark steps (700 to 950) take light text, while the middle steps are the ones to check. Use the contrast checker for any pair.
Why does the scale use OKLCH?
OKLCH separates lightness from color, so each step can be set to a chosen lightness without the hue drifting. In HSL a blue and a yellow at the same lightness value look very different in brightness, which is why scales built in HSL often look uneven.
Keep going
Use the scale in the other tools.
Content updated