Free tool CSS gradient generator with draggable color stops
Pick colors, drag the stops and watch the preview change. The preview is painted by exactly the CSS you copy, so what you see is what your page will render. Linear, radial and conic gradients, repeating patterns, opacity and a Tailwind class are all here.
- Linear, radial and conic
- Works with a finger or a mouse
- Runs locally
Design the gradient, copy the CSS
Start from the sample or a preset. Tap the bar to add a color stop, drag a handle to move it.
Saved to My tools
Open the free tools page next time and it is right at the top under My tools (stored in this browser only).
You can also press Ctrl+D to bookmark this page in your browser.You can also press ⌘+D to bookmark this page in your browser.You can also tap your browser’s Share button (at the bottom in Safari) and choose Add Bookmark or Add to Home Screen.You can also open the ⋮ menu at the top right and tap ☆ to bookmark it, or choose Add to Home screen.You can also tap ··· at the top right and choose Favorite, or open it in your browser and bookmark it there.
View My toolsColor stops
Tap an empty spot on the bar to add a stop. Drag a handle to move it; arrow keys nudge it and Delete removes it.
Editing stop 1
Gradient type
Quick directions
The output writes a plain sRGB version first, so browsers that do not understand “in oklab” or “in oklch” still show a gradient.
Presets
.gradient {
background-color: #4f46e5;
background-image: linear-gradient(135deg, #4f46e5 0%, #a855f7 50%, #ec4899 100%);
}bg-[linear-gradient(135deg,#4f46e5_0%,#a855f7_50%,#ec4899_100%)]Share these inputs: the values go after the # in the link, so they never reach a server.
https://tapcub.com/tools/css-gradient-generator
Done here? Try these next
Use this tool often? Save it to My tools.Saved to My tools. Find it any time at the top of the free tools page. You can also press Ctrl+D to bookmark this page in your browser.You can also press ⌘+D to bookmark this page in your browser.You can also tap your browser’s Share button (at the bottom in Safari) and choose Add Bookmark or Add to Home Screen.You can also open the ⋮ menu at the top right and tap ☆ to bookmark it, or choose Add to Home screen.You can also tap ··· at the top right and choose Favorite, or open it in your browser and bookmark it there.
Problem or suggestion?Send feedbackChat with support
Version v1.0Updated Update history
What each line of the CSS does
The code block is short on purpose. Here is what you are pasting.
- Linear, radial, conic and repeating
- Drag stops on touch or mouse
- CSS and Tailwind output

background-color
A solid fallback in the first stop’s color. It is only written when every stop is fully opaque; with transparency it would show through and change the look.
background-image
The gradient itself. A gradient is an image, so it layers with other backgrounds: separate several with commas and the first one is drawn on top.
Two background-image lines
When you choose OKLab or OKLCH, the first line is the sRGB version and the second adds in oklab. A browser that cannot parse the second line keeps the first.
Tailwind class
An arbitrary value such as bg-[linear-gradient(135deg,#4f46e5_0%,#ec4899_100%)]. Underscores stand for spaces, so it can sit directly in a class attribute.
A gradient has no size of its own: it fills the element’s box. The same CSS on a wide banner and a square card gives different slopes for corner-to-corner effects, so check it at the real size.
From two colors to production CSS
Most gradients take under a minute.
-
1
Choose a type
Linear for backgrounds and buttons, radial for glows and spotlights, conic for color wheels, pie slices and angular sheens. Or start from a preset.
-
2
Set the stops
Tap the bar to add colors and drag them into place. Select a stop to type an exact color, position or opacity. Two stops at the same position make a hard edge.
-
3
Aim it
For linear, set the angle with the slider or the arrow buttons. For radial and conic, drag the center handle on the preview or tap where the middle should be.
-
4
Copy
Copy the CSS rule into your stylesheet, or the class into your Tailwind markup. The share link restores the whole design later.
Angles, lengths and stops
These rules come from the CSS Images specification and explain most surprises.
0degpoints up and angles grow clockwise:90degruns left to right,180deg(the default) top to bottom- The gradient line is long enough that the corners get the pure end colors:
|W × sin A| + |H × cos A| - A stop placed before an earlier one is moved up to it, which creates a hard edge
- Colors blend in premultiplied RGBA, so fading to transparent does not turn grey
| Function | Colors change along | Typical use |
|---|---|---|
linear-gradient() | a straight line at an angle | page and button backgrounds, image overlays |
radial-gradient() | rays from a center point | glows, vignettes, spotlight effects |
conic-gradient() | a turn around a center point | color wheels, pie charts, loading rings |
repeating-… | the same, tiled | stripes, rings, rays |
A 135° gradient on a 400 × 200 card
The sample uses three stops: #4f46e5 at 0%, #a855f7 at 50% and #ec4899 at 100%. Here is where those colors land on a 400 × 200 pixel box.
| Quantity | Calculation | Result |
|---|---|---|
| Gradient line length | 400 × sin 135° + 200 × |cos 135°| = 282.8 + 141.4 | 424.3 px |
| 0% stop (#4f46e5) | start of the line, at the top-left corner | 0 px |
| 50% stop (#a855f7) | half the line, passing through the center | 212.1 px |
| 100% stop (#ec4899) | end of the line, at the bottom-right corner | 424.3 px |
Because the box is not square, 135deg does not run exactly corner to corner. Use to bottom right by hand if you need the end colors to sit precisely in opposite corners and the middle color to cross the other two.
Why a gradient looks wrong
Each of these has a one-line fix.
The element has no height
A background only paints where the box is. An empty div is zero pixels tall, so give it a height or content.
It repeats down the page
On body, a short page tiles the gradient. Add min-height: 100vh, or background-attachment: fixed where that suits.
A muddy middle
Blending complementary colors in sRGB passes through a dull grey. Add a middle stop, or switch interpolation to OKLCH.
Unreadable text
Contrast changes along a gradient. Check the lightest and darkest parts under the text, not just the average color.
Check how the page performs after the redesign
Backgrounds are cheap, but redesigns are not always. TapCub shows how real visitors experience the pages you change.
Real-user performance
LCP, CLS, INP and more from your visitors’ browsers, by page and device type.
Learn moreScreen sizes you design for
The audience page groups visitors into CSS width ranges, so you know which preview widths matter.
Learn moreBrand color on the chat widget
Set the live chat widget color to one of your gradient stops so it matches the page.
Learn moreCSS gradient questions
Still have a question?
Chat with the team behind TapCub — we usually reply within a few hours on business days.
How do I make a gradient background in CSS?
Set it as a background image, for example background-image: linear-gradient(90deg, #4f46e5, #ec4899);. Pick colors in the generator and copy the rule; give the element a height so there is something to paint.
What is the difference between linear, radial and conic gradients?
Linear changes color along a straight line, radial changes with distance from a center point, and conic changes as you turn around that point. All three accept the same kind of color stops.
How do I make stripes or hard edges?
Put two stops at the same position, such as #facc15 50%, #1d4ed8 50%. For repeating stripes, enable the repeat option and keep the stops inside a small range like 0–10%. The Stripes preset shows it.
How do I fade a gradient to transparent?
Select a stop and lower its opacity to 0. Keep the same color on both sides and change only the opacity for a clean overlay on photos, as in the Image overlay preset.
Does the generated CSS need vendor prefixes?
No. Current browsers support the unprefixed gradient functions. Only the newer in oklab and in oklch syntax needs the sRGB line before it, which the output adds for you.
Can I animate a CSS gradient?
Browsers do not interpolate between two gradient images. Common tricks are moving a larger background with background-position, or animating a registered custom property that the gradient uses.
Can I use the gradient inside a canvas or an image?
Not by pasting the CSS. In canvas use createLinearGradient, createRadialGradient or createConicGradient with the same colors and stops; the line length formula above gives the start and end points of a linear one.
Is my design uploaded anywhere?
No. Everything is calculated in your browser. The share link stores the settings after the # in the address, which is not sent to the server.
Is this tool working for you?
Rate it, or tell us what went wrong and what you’d like improved. A person reads every message, and frequent requests go into the next update.
Need help right now?
Chat with our support team, best for urgent problems; you can leave a message when we are offline.
Chat with supportUpdate history
New features, fixes and data refreshes for this tool, newest first.
-
· v1.0
LaunchedFirst release.
Missing something or found an error? Tell us — requests that come up often go into the next update. All tool updates
Recommend this tool in an article or on your site
This tool is free to cite and share. Copy the URL or link below into your article, tutorial or resource page; to write a review, embed a tool or partner with us, get in touch.
https://tapcub.com/tools/css-gradient-generator<a href="https://tapcub.com/tools/css-gradient-generator">CSS gradient generator - TapCub</a>Finish the card
A gradient usually needs a shadow and a layout around it.