How to use
- Start from a preset, press Random, or build your own by editing the color stops below.
- Pick a type (linear, radial or conic) and adjust the angle or position. The preview sits on a checkerboard so transparent areas stay visible.
- For each stop, set a color (
#ff0000,rgb(255,0,0),hsl(0,100%,50%),red, or the color picker), a position in percent, and an opacity. You can have 2 to 10 stops. - Choose a color format (hex, rgb or hsl), then copy the CSS code or the Tailwind class.
The three types
| Type | Color changes | Main settings | Example |
|---|---|---|---|
| linear | along a straight line | angle | linear-gradient(180deg, #ff7e5f 0%, #feb47b 100%) |
| radial | outward from a point | shape, size, center | radial-gradient(circle closest-side at 30% 70%, #ffffff 0%, #1e3a8a 100%) |
| conic | around a center point | start angle, center | conic-gradient(from 0deg at 50% 50%, #ff0000 0%, #ffff00 33%, #00ff00 66%, #ff0000 100%) |
Angles start at 0deg pointing up and increase clockwise: 90deg runs left to right and 180deg runs top to bottom. Values outside 0-360 wrap around (370 becomes 10). Radial size can be closest-side, closest-corner, farthest-side or farthest-corner; the default is farthest-corner.
Stops and hard stops
Every color has a position, and colors blend between neighboring stops. Put two colors at the same position and the blend disappears, leaving a sharp edge called a hard stop.
- Red at 50%, blue at 50%:
linear-gradient(90deg, #ff0000 50%, #0000ff 50%)gives a red left half and a blue right half. - Turn on Repeating to tile the stop range.
repeating-linear-gradient(45deg, #ffffff 0%, #cccccc 10%)makes diagonal stripes every 10%.
Sort by position reorders stops by their position value, and Reverse colors flips both the color order and the positions.
Transparency
Lowering opacity adds an alpha value, written differently per format.
- rgb:
linear-gradient(90deg, rgb(0 0 0 / 0.6) 0%, rgb(0 0 0 / 0) 100%) - hsl:
hsl(0 0% 0% / 0.5) - hex: an 8-digit
#rrggbbaawhen alpha is below 1.
A common use is a dark fade at the bottom of an image so text stays readable. Ending on the same color at alpha 0, rather than the keyword transparent, makes it obvious which color is fading out.
Good to know
- Fallback color adds the first color as a
background-colorline before the gradient, so environments without gradient support still show a solid color. - The Tailwind output uses the arbitrary-value syntax
bg-[...]with spaces replaced by_. Your Tailwind version has to support arbitrary values. - If text sits on top, check contrast at both the lightest and darkest points of the gradient. WCAG asks for at least 4.5:1 for body text. The Color Code Converter shows the contrast of a single color.
Related tools
- Color Code Converter: convert between HEX, RGB and HSL.
- Color Palette Generator: find colors that go together.
- Random Color Generator: draw random colors.
- CSS Beautifier & Minifier: tidy the code before it goes into your stylesheet.
The colors and settings you enter are processed in your browser only and never sent to a server.