How to use CSS Gradient Generator
- Choose Linear, Radial or Conic. Set an angle for Linear or Conic, or choose an editable color example.
- Choose endpoint colors and positions. To add intermediate colors, enter #hex position% in Extra color stops, one per line, in increasing order between the endpoints.
- Inspect the preview, then select Generate CSS and copy the rule. Replace .gradient with your selector and check it on the actual box and behind any text.
Example: CSS Gradient Generator
Create a left-to-right green gradient with a solid first-color fallback.
Options
- Gradient type
- Linear follows the chosen direction. Radial spreads as a circle from the center. Conic sweeps around the center from the selected starting angle.
- Angles
- For a linear gradient, 0° points up, 90° right and 180° down. Conic uses the angle as its starting position. Radial ignores the angle.
- Color stops
- Use two endpoint colors and up to six extra stops. All positions must increase strictly from the first to the last and stay between 0% and 100%. Equal-position hard stops are outside this tool’s input rules.
- Solid fallback
- The copied rule sets background-color to the first color before background-image. A browser that ignores the gradient can still show that solid color.
Supported inputs and limits
- Two to eight hex color stops are supported.
- Extra stops sit between the two endpoint controls, in increasing order.
- Positions must be distinct and run from 0% to 100%; angles run from 0 to 360 degrees.
- Extra stop text is limited to 2,048 characters.
- Preview and copied CSS use the same validated values.
More details
This writes one background-image rule and a solid fallback; it does not edit an existing stylesheet or check color contrast.
Sliders update the existing native preview.
Draggable stop handles, random gradients and Tailwind/image exports are not provided.
Where your input is processed
This tool does not upload your inputs. See the limits for anything saved on your device.
Check the gradient on the intended box
A linear gradient’s 0° direction points up and angles increase clockwise. The gradient paints within the element’s box, so one rule can look different on a wide button and a tall panel. Test the real size and any text over it. Color stops do not guarantee text contrast across the whole surface.
Questions about CSS Gradient Generator
Can I use the generated CSS in any browser?
Check the gradient type in the browser versions you support. The copied rule includes a solid first-color fallback if its background image is ignored, but the tool does not test your browsers or the readability of text placed over it.
Why does the preview look different from my page?
The preview uses a fixed box on a plain background. Your element may have a different size, border radius or background behind it, and those change how the same gradient reads.
How do I add more than two colors?
Keep the endpoint colors in their controls. Add intermediate colors in Extra color stops, such as #ff0000 50%. Use one line per stop, with positions strictly between the endpoints and increasing from line to line. The total limit is eight colors.
Does the page change my site or store the colors?
No. The gradient is built in this browser, and nothing is saved or sent anywhere.