Tailwind Gradient Generator
Tailwind’s gradient utilities — bg-gradient-to-r, the from-/via-/to- color stops, the way direction and color combine into a single readable class string — are easy to use once you know the pattern, but tedious to get exactly right by hand, especially with three-color gradients or non-default angles. This tool gives you a visual gradient builder: pick direction, pick colors, adjust stops, and it outputs the exact Tailwind class string, ready to paste into a className or class attribute.
Why local processing matters here
The part of this workflow that actually deserves care isn’t the gradient direction — it’s the color values. Brand palettes are often not public before a launch, and picking exact hex codes for a client’s or employer’s unreleased design system is effectively handling proprietary brand identity data. A server that logs input colors, even innocuously, is one more place those values exist outside your control before the brand goes live. Building the gradient entirely in-browser means the exact palette you’re testing never has to be transmitted anywhere to produce a working class string.
How to use it
- Pick a gradient direction from the visual compass (to right, to bottom-right, to top, and so on) — this maps directly to Tailwind’s
bg-gradient-to-*utilities. - Set your starting color (
from-) using the color picker or by entering a hex value directly, if you already have exact brand colors to match. - Add a middle color stop (
via-) if you want a three-color gradient rather than a simple two-color transition — this is optional and can be removed if two colors is enough. - Set your ending color (
to-). - If your colors are custom (not part of Tailwind’s default palette), the tool will output them as arbitrary value syntax (e.g.
from-[#1a2b3c]) rather than forcing a mismatch to the nearest built-in shade. - Copy the finished class string and paste it directly into your markup — no separate CSS file needed, which is the point of using Tailwind’s utility approach in the first place.
Common situations this solves
- Matching a gradient in a design comp exactly, including custom brand colors that aren’t in Tailwind’s default palette.
- Building a hero section or CTA button background without leaving your editor to look up gradient class syntax.
- Testing a few gradient direction and color-stop combinations quickly before settling on one for a component.
- Converting a gradient you already have as raw CSS (
linear-gradient(...)) into equivalent Tailwind utility classes. - Building consistent gradient treatments across multiple components by reusing the same generated class string as a base.
FAQ
Why does my gradient look different in Tailwind than the raw CSS version? This is usually a color-stop position difference — Tailwind’s default from/via/to stops assume even spacing (0%, 50%, 100%), while a hand-written CSS gradient might use custom percentages. If you need exact stop control, recent Tailwind versions support arbitrary stop positions like from-10%.
Can I use colors from Tailwind’s default palette instead of custom hex values? Yes — toggling to palette mode lets you pick from Tailwind’s named shades (like blue-500 or emerald-400) instead of entering hex codes, which keeps the output shorter and consistent with the rest of a project already using default Tailwind colors.
What’s the difference between bg-gradient-to-r and just setting a direction in degrees? Tailwind’s directional utilities map to fixed compass directions rather than arbitrary angles. If you need a specific angle that doesn’t match one of the eight directions, you’ll need arbitrary value syntax for the full linear-gradient() background instead.
How do I know which exact hex value maps to a given Tailwind color name? The Tailwind Colors Reference has the full default palette with hex values for every shade, which is useful for checking whether a brand color already has a close match in Tailwind’s defaults before treating it as fully custom.
Can I convert a color between hex, RGB, and HSL while building the gradient? Not inside this tool directly, but the Color format converter handles conversions between color formats if a design comp gives you a value in a format Tailwind’s syntax doesn’t expect directly.
Does this support radial or conic gradients, or only linear? Linear gradients are the primary focus, matching Tailwind’s most commonly used gradient utilities; for radial or conic gradients, the CSS Gradient Visual Picker covers the broader CSS gradient syntax beyond what Tailwind’s utility classes natively support.