Skip to content

CSS gradient generator. Linear, radial, conic.

Pick a gradient type, add color stops, set the angle. Live preview renders behind a sample card. Copy the CSS or the Tailwind snippet. Browser-only, no upload, no signup.

Type: · Presets:
Color stops
    Preview
    CSS output
    // CSS appears here
    Tailwind config snippet
    // Tailwind extend.backgroundImage snippet

    Privacy: gradient generation happens in your browser. Nothing is sent or logged.

    § · written guide

    How to use the CSS Gradient Generator

    This generator builds a CSS background gradient from a type, an angle and a list of color stops, and shows it live in a large preview. It writes the background rule for you and a Tailwind config snippet that turns the same gradient into a reusable class. It is for designers and front end developers who want a gradient they can paste straight into a stylesheet.

    Step by step

    1. Pick a type

      Next to Type, choose linear, radial or conic. Linear is selected when the page opens. Linear runs in one direction, radial spreads out from the center, and conic sweeps around the center like a clock hand.

    2. Set the direction or shape

      For linear and conic, drag the Angle slider from 0 to 360 degrees in steps of 5, or press one of the shortcuts from 0° to 270°. The default is 180, top to bottom. For conic the angle sets where the sweep starts. For radial the slider is replaced by Radial shape, where you pick ellipse or circle.

    3. Start from a preset if you like

      Under Presets, press moss, sunset, ocean, cream, ember or aurora to load a ready set of color stops. A preset only replaces the stops; the type and angle you chose stay as they are.

    4. Edit the color stops

      Each row under Color stops has a color swatch, a hex code box, a position slider from 0 to 100% and the position in percent. Press + add stop to add a stop 10% after the last one (never past 100%), in the same color. Press the × at the end of a row to remove it; you always keep at least two stops.

    5. Copy the code

      Press copy CSS next to CSS output for a ready background rule, or copy snippet next to Tailwind config snippet for a tailwind.config.js block and a usage line. The button text changes to copied for a moment when it works.

    Reading the output

    • With the defaults, the CSS output is background: linear-gradient(180deg, #3f6b54 0%, #0f1713 100%); which fades from moss green at the top to near black at the bottom.
    • Stops are written in the order of the rows, each as a color and a position, so the row order is the order the colors appear.
    • The Tailwind snippet adds the gradient under extend.backgroundImage with a key such as linear-gradient-ab12. The ending comes from the clock and changes with every edit, so rename it to something meaningful before you commit it.

    Tips and common mistakes

    • Keep stop positions rising from top row to bottom row. In CSS a stop placed lower than an earlier one is pushed up to match it, which gives a hard edge.
    • The stop list is rebuilt after every change, so the box you are in can lose focus. Paste a whole hex code such as #1e3a8a into the code box, and click the slider at the spot you want rather than dragging it.
    • Two stops of the same color at 45% and 55% give a flat band in the middle; two different colors at the same position give a sharp line.
    • Check text contrast over both ends of the gradient, not just the middle, before you use it behind copy.

    Privacy and limits

    The gradient and the code are built in your browser. Nothing is sent anywhere and nothing is saved, so reloading the page brings back the default moss to black gradient. Copying uses your browser's clipboard.

    Back to the tool

    § 02 · gradient design rules

    Five rules. Defaults that read.

    Rule 1: Two-stop is the default. Most production gradients are two colors flowing one direction. The simplicity is the appeal, your eye reads the depth without parsing a complex color story. Add a third stop only when the middle color genuinely contributes (warming a sky, adding a glow midpoint). Above three stops you're usually painting yourself into a corner.

    Rule 2: Adjacent hues, varied lightness. Gradients that span across the color wheel (red → blue) often look muddy because the midpoint lands somewhere unappealing. Gradients that stay within one hue family but vary in lightness or saturation read clean, sage to forest, peach to terracotta, ivory to cream. The two preset gradients on this page (moss, ember) demonstrate the pattern.

    Rule 3: Match the angle to the content. 180deg (top-to-bottom) is the convention for sky / atmospheric backgrounds. 135deg or 45deg adds visual energy, used in marketing hero gradients to suggest motion. 90deg (left-to-right) is the convention for progress bars and timeline elements. 0deg (bottom-to-top) is unusual and reads as "rising", useful for graphs or growth-themed surfaces.

    Rule 4: Soft transitions read as premium; hard transitions read as playful. A gradient with stops at 0% and 100% has the smoothest possible transition. Adding a stop at 50% with the same color creates a flat midpoint. Stops at 45% and 55% create a hard edge in the middle (used in retro-styled designs). The position of the stops controls the rhythm; the colors control the palette.

    Rule 5: Test on the darkest content the gradient will hold. A gradient that looks beautiful empty often loses contrast when text is placed over it. Always test with the actual text content, especially body copy at small sizes. Pair with our Color Contrast Checker to verify WCAG AA compliance over the gradient's darkest and lightest points.

    § 03 · when to use this

    Four jobs this tool covers.

    Job 1: Build a hero background. Pick the type, drop in the brand colors, set the angle, copy the CSS. Most modern landing pages use a subtle linear gradient instead of flat color for the hero, adds depth without distracting from the content. The Tailwind snippet drops directly into a design-system config so the gradient becomes a reusable token.

    Job 2: Design a button hover state. Two-stop linear gradients are the convention for button hover effects. Build in default state, copy the CSS, build hover state slightly brighter, copy that CSS, wire to :hover. The shift in gradient between states is what gives buttons their tactile feel.

    Job 3: Create a brand color story. When designing a new brand palette, build several gradients across the candidate colors to see how they interact. Gradients reveal which color combinations are harmonious and which fight. Pair with our Color Contrast Checker for the accessibility-floor check.

    Job 4: Design system tokens. The Tailwind snippet output is the format design-system maintainers use. Drop into your tailwind.config.js under extend.backgroundImage and the gradient becomes a utility class everyone on the team can use consistently. Pair with our web design service on a real engagement.

    § 04 · questions

    Six questions users ask.

    Linear vs radial vs conic, which to use?

    Linear gradients flow in one direction (top-to-bottom, left-to-right, any angle) and read as classic depth or atmosphere, sky, surface, button-fill. Radial gradients emit from a center point outward and read as light source or focal emphasis, spotlight effect, glow halo, button hover. Conic gradients sweep around a center point like a clock hand and read as circular progress, color wheel, or playful texture. About 80% of production gradient use is linear; radial and conic are reserved for specific effects.

    How many color stops should I use?

    Two for clean depth (the modern brand-system default), three for warmer atmospherics (sunset, foliage), four-plus for lively or playful surfaces. More than five stops usually reads as confused, pick the colors that genuinely contribute and drop the rest. The position percentages matter more than people think; a 0%/100% gradient is symmetric, a 0%/30%/100% gradient pushes the second color toward the start (giving the feel of a soft glow). Drag the positions in the live preview to find the rhythm.

    What's the angle parameter for linear gradients?

    The angle in degrees from which the gradient points TO. 0deg points up (gradient flows from bottom to top). 90deg points right (left to right). 180deg points down (top to bottom, most common for sky / button gradients). 270deg points left. Any value 0-360 works. The keyword forms ('to top', 'to right', 'to bottom right') translate to specific angles internally; the keyword form is more readable but the angle form is more flexible for off-axis directions.

    Do gradients hurt performance?

    No, modern browsers render CSS gradients as fast as solid colors, they're computed once at element paint time and don't trigger reflow. The performance concern is animating gradient stops or positions, which forces a repaint per frame; use CSS custom properties + transform-based animation instead. For static gradients, no performance cost. For very complex gradients (10+ stops or layered backgrounds), the file size of the CSS itself is the only concern, and even that is negligible.

    What about browser support for conic gradients?

    Conic gradients have been baseline-supported in all major browsers since 2022 (Chrome 69, Safari 12.1, Firefox 83, Edge 79). For audiences on browsers older than that (vanishingly small in 2026), the conic gradient falls back to whatever background-color you set. Linear and radial gradients have universal support back to IE10. No need to ship vendor prefixes for any gradient type in 2026, every browser interprets the unprefixed form correctly.

    Is the gradient I build sent anywhere?

    No. Generation happens entirely in your browser. The page is static HTML; the only network request is the initial page load. Safe for unpublished brand explorations or any color choices you don't want shared with a third party.

    Published · Last updated .

    Priya sent you a message Online now

    Talk to a Developer Now

    Share your name and email to reply.

    Reply