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
Click the Color 1 swatch and choose your starting color from the native color picker.
- 2
Click the Color 2 swatch and choose the color the gradient fades into.
- 3
Drag the Angle slider from 0 to 360 degrees to set the gradient direction; the live preview updates instantly.
- 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?▼
Can I add more than two colors?▼
What does the angle value mean?▼
Are CSS gradients performant?▼
Can I animate this gradient?▼
What color format does it output?▼
Is my data uploaded anywhere?▼
Related tools
Color Converter (HEX/RGB/HSL)
Convert colors between HEX, RGB, HSL, OKLCH.
CSS Box Shadow Generator
Build CSS box-shadow visually.
Cubic Bezier Generator
Build CSS easing curves visually.
Color Palette Generator
Generate harmonious color palettes from any base color.
CSS Border Radius Generator
Build complex CSS border-radius visually.
CSS Clamp Generator
Generate responsive CSS clamp() functions.