CSS Gradient Generator
Build a CSS gradient from two colors with an angle slider and a linear or radial switch. Preview it live, then copy the ready-to-paste background CSS.
What is a CSS gradient?
A CSS gradient is a smooth blend from one color into another, drawn by the browser with one line of CSS. No image file is needed: the browser paints the blend itself, so the gradient stays sharp at any screen size and adds no download weight to the page. That is why gradients are used for hero backgrounds, buttons, and cards.
The two colors in this tool are #3B82F6, a medium blue, and #FF5733, a warm orange-red. Blue to orange-red is a strong contrast blend, so it shows the gradient effect clearly — the middle of the blend is a visible purple-brown where the two colors meet.
Live gradient bar — it follows the two colors in the tool above
Linear gradients and the angle
A linear gradient blends in a straight line, and the angle sets the direction of that line. An angle of 0° runs bottom to top, 90° runs left to right, 180° runs top to bottom, and 270° runs right to left. The default 135° runs from the top-left corner to the bottom-right corner, which is the most common direction for page backgrounds.
Dragging the slider is the fastest way to learn the angles: watch the preview rotate as the number changes, and stop when the blend runs the way your design needs. The CSS updates with the slider, so the copied line always matches the preview on screen.
Angle dial — the arrow points the way the blend runs
Angle: 135° — 0° runs bottom to top, 90° left to right, 180° top to bottom, 270° right to left.
Radial gradients
A radial gradient blends outward from a center point, like rings spreading on water. The start color sits in the middle and the end color forms the outer edge. It suits circular highlights, spotlights behind a heading, and soft glows much better than a straight linear blend.
The radial CSS for the default colors is background: radial-gradient(circle, #3B82F6, #FF5733);. The word circle keeps the shape round; without it the browser stretches the gradient into an ellipse that follows the panel shape. This tool always writes circle so the result is predictable.
Radial preview — start color at the center dot, end color at the edge
Center: #3B82F6 — edge: #FF5733
How to use the CSS on your site
Copy the CSS line and paste it as the background of any element. The copied line is a complete declaration: background: linear-gradient(135deg, #3B82F6, #FF5733);. Paste it into a class in your stylesheet, and every element with that class gets the gradient. Add a plain background-color line before it as a fallback for very old browsers.
Use gradients sparingly: one gradient hero or one gradient button per page is enough. Two or three different gradients on one screen compete with each other and make the page look busy, so pick one direction and one color pair and reuse it.
The exact CSS line the tool copies
background: linear-gradient(135deg, #3B82F6, #FF5733);A button wearing the same gradientCopy the line from the tool above, paste it as the background of any element.
Choosing two colors that blend well
Two colors blend well when they are far enough apart in hue to show a change, but close enough in lightness to stay smooth. Blue #3B82F6 and orange-red #FF5733 sit almost opposite each other, so their blend is bold and visible. Two near-identical blues would blend so gently that the gradient is barely visible.
If the middle of your blend turns muddy gray or brown, the two colors are fighting each other. Fix it by picking colors that are closer in hue — for example two blues — or by accepting the bold middle as a feature and using the gradient only in a thin strip.
Blend midpoint inspector — the exact middle of the blend
Midpoint color: #9D6D95 — the 50/50 mix of the two colors.
All color tools
21 tools, one topic — see About Hex Color Code Picker for who built this site.
- Color Picker from ImageUpload an image, click a pixel, and read its HEX code.
- Screen EyedropperSample any pixel on your screen.
- RGB to HEX ConverterTurn three RGB numbers into one HEX code.
- HEX to RGB ConverterTurn a HEX code into three RGB numbers.
- HEX to HSL ConverterTurn a HEX code into hue, saturation, and lightness.
- HSL to HEX ConverterTurn HSL values back into a HEX code.
- HEX to HSV ConverterTurn a HEX code into hue, saturation, and value.
- HEX to CMYK ConverterTurn a HEX code into approximate print values.
- RGB to HSL ConverterTurn RGB numbers into hue, saturation, and lightness.
- HEX to OKLCH ConverterTurn a HEX code into the modern OKLCH format.
- Color ConverterSee one color in every format at once.
- HEX to RGBA ConverterTurn a HEX code into RGB with transparency.
- Color Name to HEXLook up any of the 148 CSS named colors.
- Color Palette GeneratorBuild a five-color palette from one color.
- Shades GeneratorBuild 10 tints and 10 shades from one color.
- Gradient GeneratorBuild a linear or radial gradient and copy the CSS.
- Contrast CheckerCheck any text and background pair for AA and AAA.
- Color MixerMix two colors and see the result.
- Random Color GeneratorPick a random color from all 16,777,216 HEX colors.
- Color Blindness SimulatorSee your colors as color-blind users see them.
- Color ChartThe 148 named colors with HEX, RGB, and HSL.
No tool matches your search.
Frequently asked questions
Pick two colors, set the angle, and copy the CSS line. The defaults are #3B82F6 to #FF5733 at 135°, which gives background: linear-gradient(135deg, #3B82F6, #FF5733);. Paste that line as the background of any element in your stylesheet.
Use 135° for a diagonal page background, 90° for left-to-right, and 180° for top-to-bottom. The angle slider runs 0–360°, and the preview rotates as you drag it. Stop when the blend runs the way your design needs — the copied CSS always matches the preview.
Linear blends in a straight line; radial blends outward from a center point. Linear suits backgrounds and buttons, radial suits glows and circular highlights. This tool writes radial gradients as radial-gradient(circle, ...) so the shape stays round.
Not in this tool — it blends exactly two colors. Two colors cover the most common gradients: backgrounds, buttons, and cards. If you need three or more stops, add the extra color stops to the copied CSS line by hand, between the two colors.
Yes — linear and radial gradients work in all modern browsers. Paste the copied line as-is. For very old browsers, add a plain background-color line before it as a fallback, so the element still shows a solid color if gradients are not supported.
The two colors are too far apart in hue, so their midpoint mixes into gray or brown. Pick colors closer in hue — for example two blues — for a smooth blend, or use the bold midpoint on purpose in a thin strip. The midpoint inspector on the preview shows the middle color before you copy.