CSS gradient generator

Pick a gradient type, set the colors and their positions, and copy the CSS or a Tailwind CSS class. You can also paste an existing gradient to edit it.

Type
Color stops 2 to 8. Position is a percentage along the gradient.

    Presets
    CSS
    
      
      
    Tailwind CSS class
    
      

    How to use the CSS gradient generator

    1. Choose Linear, Radial or Conic, and tick Repeating if you want the pattern to tile.
    2. Set the direction: an angle or a quick direction button for linear, a shape and position for radial, a from angle and position for conic.
    3. Edit the color stops: type any color or use the picker, set each position in percent, and use Add stop, × and Reverse.
    4. Optionally pick an Interpolation color space such as in oklch to change how colors blend between stops, and for OKLCH a Hue path (shorter or longer). Or start from one of the Presets.
    5. Copy the CSS or the Tailwind CSS class, or Copy link to share the settings. To edit an existing gradient, paste it into the box at the bottom and click Load.

    What it does

    The generator writes a CSS background declaration for the three gradient functions in CSS Images: linear-gradient(), radial-gradient() and conic-gradient(), plus their repeating- versions. Colors are written as lowercase HEX, or 8-digit HEX when a stop is transparent. The preview, the settings and the shareable link are all handled in your browser.

    TypeColors change alongExample output
    LinearA straight line at an anglelinear-gradient(90deg, …)
    RadialOutward from a center pointradial-gradient(circle at center, …)
    ConicAround a center point, like a clock handconic-gradient(from 0deg at center, …)

    How the angle and stops work

    In linear-gradient(), 0deg points up and angles turn clockwise, so 90deg runs left to right and 180deg (the default) runs top to bottom. The keyword directions such as to top right aim at the box's corner, so their real angle depends on the box's shape; the quick buttons here write fixed angles instead. For a conic gradient, the from angle rotates where the first color starts, again with 0deg at the top.

    Each stop's percentage is a point along the gradient line (or around the circle for conic). Two stops at the same position make a hard edge, which is how the stripes preset works. In a repeating gradient, the stops from first to last form one tile that repeats, so stops ending at 10% repeat ten times along the gradient line.

    Interpolation color spaces

    CSS Images Level 4 lets a gradient say which color space to blend in, such as linear-gradient(90deg in oklch, …). When the stops are HEX, rgb(), hsl() or named colors and no space is written, browsers blend in sRGB, as they always have. Blending in sRGB can turn the middle of a gradient gray or muddy; Oklab keeps lightness more even; OKLCH also keeps chroma, so the middle stays vivid, and it can take the shorter or longer way around the hue wheel.

    Support for the in <color space> syntax arrived in Chrome and Edge 111, Safari 16.2 and Firefox 127, according to MDN's compatibility data. Older browsers treat the whole declaration as invalid and skip it, so when you choose a space the tool writes a plain line first. That line is the fallback; browsers that understand the second line use it instead.

    Worked example

    Stops #4F46E5 at 0% and rgb(245, 158, 11) at 100%, angle 135, color space in oklch, produce:

    background: linear-gradient(135deg, #4f46e5 0%, #f59e0b 100%);
    background: linear-gradient(135deg in oklch, #4f46e5 0%, #f59e0b 100%);

    and the Tailwind class bg-[linear-gradient(135deg_in_oklch,#4f46e5_0%,#f59e0b_100%)]. The color halfway along differs by space. In sRGB it is #a27278, a dusty pink. In Oklab it is #9b82a2, a grayish mauve. In OKLCH the hue takes the shorter path from 276.97° to 70.08° through 353.52°, giving a vivid #e04b95. These midpoints are computed by this tool's own conversion code; browsers may round slightly differently.

    Tailwind CSS classes

    With a gradient value, Tailwind's bg-[…] arbitrary value sets background-image. (Tailwind v4's own bg-linear-* utilities blend in Oklab by default; the class here copies your CSS exactly instead.) Spaces are not allowed inside a class name, so each space becomes an underscore, which Tailwind turns back into a space at build time. The class has no fallback line, so if you use a color space and need older browsers, use the CSS instead. Tailwind CSS v4 also has its own bg-linear-*, bg-radial and bg-conic utilities with from-, via- and to- colors.

    Common mistakes

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

    Key terms

    Color stop
    A color and an optional position in a CSS gradient, such as #4f46e5 30%. The gradient blends between neighboring stops; two stops at the same position make a hard edge.
    Linear gradient
    A CSS image whose colors change along a straight line set by an angle or a direction keyword. In CSS, 0deg points up and 90deg runs left to right.
    Radial gradient
    A CSS image whose colors spread outward from a center point as a circle or an ellipse. The center can be moved with an at position such as at top left.
    Conic gradient
    A CSS image whose colors change around a center point, like the sweep of a clock hand. It is used for color wheels and pie-chart effects.
    Repeating gradient
    A variant of a CSS gradient that tiles the run from the first to the last stop to fill the box, used for stripes and rings.
    Interpolation color space
    The color space in which a browser blends between two colors, written in CSS gradients as in srgb, in oklab or in oklch. It changes the colors in between, not the stops themselves.
    OKLCH
    A CSS color format of lightness, chroma and hue, built on the OKLab color space published by Björn Ottosson in 2020. Equal steps in its lightness look roughly equal to the eye, which plain HSL does not manage. Tailwind CSS v4 defines its default palette in OKLCH.
    Arbitrary value
    A Tailwind CSS class with a custom value in square brackets, such as bg-[linear-gradient(90deg,red,blue)]. Spaces are written as underscores.

    Frequently asked questions

    How do I make a gradient go left to right?
    Use a linear gradient at 90deg, or the right-arrow direction button. 0deg points up and the angle turns clockwise.
    What does in oklch do in a gradient?
    It blends the colors in the OKLCH color space instead of sRGB, which keeps the middle of the gradient from turning gray. Leave a fallback line before it for older browsers.
    Can I edit a gradient I already have?
    Paste a linear-gradient(), radial-gradient() or conic-gradient() value into the box under the output and click Load. Positions must be percentages; size keywords such as farthest-corner are dropped.
    How do I make hard stripes?
    Put two stops at the same position, for example yellow 0% and 5%, then black at 5% and 10%, and tick Repeating. The Warning stripes preset does this.
    Which Tailwind CSS version is the class for?
    It was checked with Tailwind CSS v4, where bg-[…] with a gradient value compiles to background-image. Use the plain CSS if you need the fallback line for older browsers.
    Can I share my gradient?
    Copy link copies the page address, which holds the type, angle, stops and color space, so opening it restores the same gradient.

    Sources: CSS Images Module Level 4 (W3C), CSS Color 4: interpolation, MDN: linear-gradient(), Can I use: gradient interpolation color space, Tailwind CSS: arbitrary values, Tailwind CSS: background-image. Last checked 2026-11-17.