CSS gradient generator
Build linear, radial and conic gradients with a live preview, choosing colors, opacity and positions. Copy the CSS or a Tailwind CSS class.
Color stops
Use 2 to 8 stops. The list stays in the order you added them; the output is sorted by position (%).
Some values could not be read, so the last valid value is used (colors as HEX, rgb() or hsl(); opacity and position as numbers from 0 to 100).
You can use up to 8 stops.
Presets
Preview
An arbitrary value class that works in Tailwind CSS v3.0+ and v4. Spaces are replaced with underscores.
This value cannot be written safely as a Tailwind class name, so no class is shown.
How to use
- Choose Linear, Radial or Conic under "Type", or start from a preset.
- For linear, set the angle with the slider, the number field or a direction button. For radial, pick the shape and center position. For conic, set the start angle and position.
- For each color stop, enter a color (picker, HEX, rgb() or hsl()), opacity and position in %. Use "Add stop" for up to 8 stops.
- Check the preview, then copy the CSS (background or background-image) or the Tailwind CSS class.
Notes and limits
- You can use 2 to 8 color stops. Two positions on one stop and color hints (midpoints) are not supported.
- The output sorts stops by position. Stops at the same position keep their list order.
- Translucent colors are written as 8-digit HEX (#rrggbbaa). Current major browsers support it; very old browsers may not.
- Radial size keywords (such as closest-side), repeating gradients and layered gradients are not available.
- The Tailwind output is an arbitrary value class for v3.0+ and v4. It is not converted to from-, via- and to- utilities.
How it works
Linear output is linear-gradient(angle, color position, ...), radial is radial-gradient(shape at position, ...), and conic is conic-gradient(from angle at position, ...).
Angles are rounded to whole degrees from 0 to 360 and positions to 0-100% with one decimal. In CSS, 0deg points up and angles increase clockwise.
For the Tailwind class, spaces after commas are removed and the remaining spaces become underscores inside bg-[...]. If the value contains underscores, quotes or similar characters, no class is produced.
FAQ
Should I use background or background-image?
background also resets other background settings such as the background color. Choose background-image if you want to keep an existing background color.
Which Tailwind CSS versions support the class?
Arbitrary value classes like bg-[...] work in Tailwind CSS v3.0 and later, including v4. They do not work in v2.
Can I fade to transparent?
Yes. Set a stop to 0% opacity or use the "Fade to transparent" preset. The checkerboard in the preview shows transparent areas.
Is my gradient saved?
No. Everything runs in your browser and nothing is saved or uploaded. Copy the CSS if you want to keep it.
Related tools
Last updated: