Free CSS gradient maker: build linear, radial and conic gradients, pick presets, and copy CSS or Tailwind code or save a PNG.
Presets
0%
100%
The first CSS line is a fallback for older browsers. Paste both lines as they are.
Result examples
Click one to load the same settings into the generator above.
Related searches
css gradient generator
linear gradient generator
radial gradient generator
conic gradient generator
css gradient maker
tailwind gradient generator
gradient background maker
Gradient Generator
gradient generator online
gradient generator free
gradient generator png
gradient generator css
gradient generator svg
gradient generator html
What is CSS Gradient Generator?
Joins two or more colors and generates CSS gradient code.
How to use
1
Choose colors and their positions.
2
Adjust the direction (angle).
3
Copy the generated CSS.
Tips
If the area between colors looks dull, try adding another color of similar brightness in the middle.
Frequently asked questions
QHow do I create a CSS gradient?
Choose a preset or colors in the generator above, set the angle, then click the CSS box to copy it. Paste that code into the element's background and you're done.
QWhat is the difference between Linear and Radial?
Linear runs in a straight line in one direction, while Radial spreads out in a circle from one point. Linear suits backgrounds and buttons, and radial suits glows and highlights.
QHow do I use the CSS code?
Paste the copied code as it is into background in your CSS file or style attribute. The first line is a fallback for older browsers, so it's best to use both lines together.
QHow do I apply a gradient in Tailwind CSS?
Click the Tailwind box to copy the bg-[...] class and put it in your class attribute. Spaces are replaced with underscores (_). If you prefer the built-in classes (bg-gradient-to-r from-… to-…), you can write them yourself using the colors as a reference.
QCan I save a gradient as a PNG?
Yes. Click the PNG download button to get a 1920×1080 image. It works well for background photos and presentations.
QCan I use it on mobile?
Yes. It fits smartphone and tablet screens, so you can use the color picker, position sliders and copy buttons with your fingers. No installation or sign-up is needed.
QHow do I connect colors smoothly?
Choose colors of similar brightness and keep smooth blending (OKLCH) turned on. Even opposite colors won't turn muddy in the middle. If it still looks off, add one more color in between.
Learn more
1How to read gradient CSS
linear-gradient blends colors in one direction, and radial-gradient blends them spreading out from the center. Changing the angle and the color stop positions (%) changes where and how fast the color shifts. Copy the generated code and paste it straight into the background property.
2Tips for making it look good
If you put colors too far apart, the middle can look muddy, so start from colors in a similar family. If the background will hold text, check that the text is readable at both the darkest and the lightest spots.
3The difference between linear, radial and conic gradients
linear-gradient is the most common kind, where color runs in one direction. An angle of 90deg runs from left to right, and 180deg runs from top to bottom. radial-gradient spreads out in a circle from a single point, and conic-gradient turns the color around the circumference of a circle, so you use it for pie charts and color wheels.
For most uses, such as backgrounds, buttons and the top of a card, linear is enough. Use radial when you want a soft spread of light, and layering colors that have transparency can give a plain background some depth.
4When the middle of a color blend looks dull, and how to fix it
If you join colors that are far apart (for example blue and yellow) directly, the middle can turn a muddy grayish color. This comes from how colors are mixed, and adding one more intermediate color between the two joins them much more cleanly. For blue to yellow, for example, put a bright green-toned color in the middle.
Modern browsers can also specify a color space, as in linear-gradient(in oklch, color1, color2), to make more natural midpoints. Browsers that don't support it ignore it, so for important places check the standard version too.
5Things to know when using gradients
When you put text over a gradient, check that the text can be read at both the lightest and the darkest part. Often the contrast is good on only one side, so laying one semi-transparent dark layer behind the text is the safe approach.
Banding, where the color steps look like stripes over a large area, often happens between two similar colors. Joining very pale colors makes the steps look coarse, so adding a slight brightness difference or laying a fine noise image on top eases it. Paste the CSS you made straight into background, and to apply it to text, use background-clip: text together with it.
6How do I create CSS gradient code?
Pick a preset or color stops, set the angle, copy the CSS shown below and paste it into background. That's all.
You can add up to 8 color stops, and each stop has its own color and position (%). Use Flip to reverse the order, or Random to discover new combinations.
The first line of the copied code is a fallback for older browsers. Paste both lines together as they are.
7Which direction does the gradient angle point?
For a linear gradient, 0 degrees points from bottom to top, and the direction rotates clockwise as the angle grows.
0deg
Direction
Bottom to top
Equivalent keyword
to top
90deg
Direction
Left to right
Equivalent keyword
to right
180deg
Direction
Top to bottom
Equivalent keyword
to bottom
270deg
Direction
Right to left
Equivalent keyword
to left
135deg
Direction
Top-left to bottom-right
Equivalent keyword
Similar to to bottom right
Angle
Direction
Equivalent keyword
0deg
Bottom to top
to top
90deg
Left to right
to right
180deg
Top to bottom
to bottom
270deg
Right to left
to left
135deg
Top-left to bottom-right
Similar to to bottom right
In a conic gradient the angle sets the starting position, so it means something different from a linear gradient.
8How do I control where each color is painted?
Changing a stop's position (%) sets where its color starts and ends.
To push a color toward one side, place its stops close together; to spread it softly, widen the gap. For example, changing blue 0% and pink 100% to blue 0% and pink 40% makes everything after 40% solid pink.
Placing two different colors at the same position creates a sharp stripe. If you set two stops each at the same position, such as blue 0%–50% and pink 50%–100%, you get a background split in half.
9Can I join opposite colors without a muddy middle?
Turn on the smooth blending (OKLCH) option and the grayish zone shrinks, even when you join blue to yellow.
The default method simply mixes screen RGB values, so saturation drops between near-complementary colors. With the option on, colors are mixed in a perceptual color space, which keeps the middle tones more vivid.
Code with this option uses modern syntax such as in oklch. Current browsers handle it fine, and older environments use the fallback value.
10Text on top of my gradient is hard to read. What should I do?
Check the text contrast at both the lightest and the darkest parts of the gradient.
If the text is bright white, check that it stays readable on the light side of the gradient.
Put the text where the colors change the least.
A semi-transparent dark overlay makes text easier to read on photos too.
Large headings can get by with slightly lower contrast, but keep a comfortable margin for body-size text.
You can check the text and background contrast ratio as a number with a color converter or a contrast checker.
11How do I make a gradient that darkens an image?
Overlay a transparent gradient that is darker at the bottom on top of a background image. The photo darkens and the text becomes easy to read.
For example, write background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0)), url(image-address); with the layers separated by commas. The first one listed is stacked on top, and the image comes last.
When fading to transparent, use the transparent value of the same color (rgba(0,0,0,0)) instead of transparent, which avoids a gray tint in some environments.
12How do I make gradient text?
Apply a gradient to the background and clip it to the shape of the letters, and the text itself gets a color shift.
Set the gradient made in this tool as the background, then set background-clip: text and make the text color transparent (color: transparent). Some browsers also need the -webkit- prefix.
If the text is small, the color change is barely visible, so use this on large text such as headings. For accessibility, also consider a solid-color alternative for important text.
13Why do I see striped bands in my gradient?
If you paint two colors with a small brightness difference over a wide area, the color can appear to step in bands.
Increase the color difference a little, or add one more color of similar brightness in the middle, and it eases. Very subtle gradients can look even more noticeable on some screens.
If the bands bother you in the preview, try narrowing the position gap so the color change happens within a shorter range.
14Can I save my gradient as an image file?
Click the PNG download button to get a 1920×1080 image.
Where you can't use code, such as presentation backgrounds, social media post backgrounds or desktop wallpapers, the image is handy.
For websites, use the CSS code instead of an image: it adds no file size and stays sharp at any resolution.
15Can I layer multiple gradients?
CSS background accepts several gradients separated by commas, and the one written first is stacked on top.
Placing a radial gradient with transparency over a linear gradient makes a dimensional background that looks like light spreading. Just join the value parts of the two codes made in this tool with a comma.
Each extra layer adds computation, so avoid stacking many layers over a very large area.
16How do I choose gradient colors that go well together?
Joining two neighboring colors on the color wheel, or a light and a dark step of one color, rarely fails.
Shades of one color: join two colors with the same hue but different brightness. It's the safest and calmest choice.
Neighboring colors: join colors close on the color wheel, such as purple and pink, or blue and teal.
Contrasting colors: opposite colors such as blue and orange are striking but tend to get muddy in the middle. Turn on smooth blending.
Three or more: set the middle color to a tone halfway between the two end colors for a smooth join.
Example code: linear-gradient(135deg, #6366f1, #ec4899) is a common combination that runs from indigo to pink.
17Can I create a spotlight effect with a radial gradient?
A radial gradient that is bright in the center and darker toward the edges gives a soft spread of light.
For radial gradients you can choose between a circle and an ellipse, with the center in the middle. To move the center, add a position yourself after the shape in the copied code, such as at 20% 30%, and it will feel like light coming in from a corner.
If you make the center color slightly transparent and put a separate background color underneath, it layers naturally over photos or solid backgrounds too.
18My button's gradient doesn't change smoothly on hover.
CSS cannot smoothly animate a gradient itself with transition, so you need another approach.
The most common way is to widen background-size to about 200% and move background-position on hover. Another way is to layer the hover gradient on a pseudo-element and change only its opacity.
Create the normal and hover gradients separately in this tool, copy the code, and apply them with the methods above.
19My background gradient is cut off or repeats.
If the element with the background is shorter than the screen, the gradient ends at the element's size and may repeat.
Give body or the top-level element min-height: 100vh, or use background-attachment: fixed or background-repeat: no-repeat together. A background on the html element spreads across the whole screen.
Fixed backgrounds sometimes don't run smoothly in mobile browsers, so check on a real device.
20What are conic gradients used for?
A conic gradient turns around a center point, so it suits color wheels, pie charts and loading rings.
Changing the starting angle rotates where the colors begin. Specifying a color twice at the same position also lets you make pie-chart-like sections.
Using the same first and last color gives a seamless full turn. Older browsers may not support it, so provide a fallback color too.
21Do gradients slow down my page?
A CSS gradient doesn't download an image file, so it's usually lighter and faster than an image.
However, using many layers over a very large area, or animating them, may not run smoothly on low-end devices. If you need movement, shifting the position or changing the opacity is lighter than changing the gradient itself.
If it feels slow on mobile, reduce the number of layers and use a solid color where it isn't needed.
22How many color stops should I use?
Two or three are enough in most cases, and the more you add, the more complicated the colors look.
This tool allows up to 8, but unless you deliberately want many colors like a rainbow, three or fewer looks cleaner. With many stops, space the positions evenly and keep adjacent colors at similar brightness.
When you find a combination you like, save the code separately. Alternating presets and Random is a quick way to find new combinations.
23How do I edit a gradient I already made?
You can edit the copied code directly, but it's safer to change the colors and positions again in this tool.
To change just a color, replace only that color part of the code with the new HEX. To change only the angle, you just edit one number.
24What is a CSS gradient?
A gradient is a background that blends smoothly from one color into another. In CSS you can write it in a single background line with no image file, so it stays light and never gets blurry at any size.
It works for buttons, banners, card backgrounds, headline text and progress bars.
25Gradient types: linear, radial and conic
The three types spread color differently. Pick the one that fits the job.
Linear
CSS function
linear-gradient()
How it looks
Runs in a straight line in one direction
Common uses
Page backgrounds, buttons, headers
Radial
CSS function
radial-gradient()
How it looks
Spreads out in a circle from one point
Common uses
Glows, spotlights, card highlights
Conic
CSS function
conic-gradient()
How it looks
Color changes as it turns around the center
Common uses
Pie charts, color wheels, avatar rings
Type
CSS function
How it looks
Common uses
Linear
linear-gradient()
Runs in a straight line in one direction
Page backgrounds, buttons, headers
Radial
radial-gradient()
Spreads out in a circle from one point
Glows, spotlights, card highlights
Conic
conic-gradient()
Color changes as it turns around the center
Pie charts, color wheels, avatar rings
26How to use a CSS gradient
1) Build the look above with a preset or color stops. 2) Click the CSS box to copy it. 3) Paste it into the style of the element you want. As shown below, it goes straight into background.
If the colors do not blend nicely, choose colors of similar brightness and add one in-between stop.
When joining opposite colors such as blue and yellow, turn on the smooth blending (OKLCH) option above so the middle does not turn gray. If text will sit on top, check that it stays readable at both the darkest and lightest spots.