RevealTheme logo

CSS Gradient Generator

Build a two-color linear CSS gradient. Pick two colors, set the angle, and copy the generated background declaration.

background: linear-gradient(135deg, #535beb, #7c3aed);

How to use this tool

  1. 1

    Click the Color 1 swatch and choose your starting color from the native color picker.

  2. 2

    Click the Color 2 swatch and choose the color the gradient fades into.

  3. 3

    Drag the Angle slider from 0 to 360 degrees to set the gradient direction; the live preview updates instantly.

  4. 4

    Copy the generated background: linear-gradient(...) line from the code box into your stylesheet.

How does a CSS linear-gradient work?

A CSS linear gradient is an image generated by the browser that blends smoothly from one color to another along a straight line. This tool outputs the most common form: linear-gradient(<angle>deg, <color1>, <color2>) assigned to the background property. The angle defines the direction the line points in: 0deg runs bottom to top, 90deg runs left to right, and 180deg runs top to bottom, increasing clockwise. With only two color stops and no explicit positions, the browser places the first color at 0% and the second at 100%, transitioning evenly across the box. Because a gradient is treated as a background image, it paints behind text and other content and scales to any element size without becoming pixelated, unlike an exported PNG. The two colors here come from native HTML color inputs, so they are always 6-digit hex values such as #535beb. This generator covers the simple two-stop case only. For radial or conic gradients, three or more color stops, explicit stop positions like 20% 80%, repeating gradients, or vendor prefixes for very old browsers, you will need to extend the declaration by hand.

Common use cases

  • Creating a hero section or landing page banner background that fades between two brand colors.

  • Generating button and card backgrounds with a subtle two-tone diagonal fade.

  • Producing a gradient overlay placed above a photo to improve text contrast.

  • Prototyping color direction quickly by dragging the angle slider before committing to final values.

  • Grabbing a ready-to-paste linear-gradient string for a Tailwind, styled-components, or plain CSS file.

  • Teaching or demonstrating how gradient angle changes the visual direction of a fade.

Frequently asked questions

Does this support radial or conic gradients?
No. This tool only generates two-color linear-gradient declarations. For radial-gradient or conic-gradient, copy the linear output as a starting point and change the function name and parameters manually.
Can I add more than two colors?
Not in this tool. It is fixed to two color stops. To add more stops, paste the output into your CSS and insert additional comma-separated colors, optionally with percentage positions.
What does the angle value mean?
The angle is the direction of the gradient line in degrees, increasing clockwise. 0deg fades from bottom to top, 90deg from left to right, and 180deg from top to bottom.
Are CSS gradients performant?
Yes. The browser renders them natively and they are typically cheaper than loading a gradient image. They also scale to any element size without quality loss.
Can I animate this gradient?
Gradient color stops are not directly animatable with CSS transitions. Common workarounds are animating background-position on an oversized gradient, or updating the colors via JavaScript.
What color format does it output?
It outputs 6-digit hex colors like #535beb, because the inputs use the native HTML color picker. You can manually convert these to rgb() or hsl() in your stylesheet if needed.
Is my data uploaded anywhere?
No. The gradient is built entirely in your browser with JavaScript. Nothing you pick is sent to or stored on a server.

Related tools