CSS Gradient Generator
Design linear, radial and conic CSS gradients with multiple color stops and copy production-ready CSS or Tailwind code.
Color stops
Drag handles to move stops, click the bar to add one. Arrow keys nudge a focused handle, Delete removes it.
- %
- %
- %
CSS
background-color: #a856de; background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
Tailwind class
bg-[linear-gradient(135deg,#6366f1_0%,#a855f7_50%,#ec4899_100%)]
Arbitrary value for Tailwind CSS v3.3+ and v4.
Presets
What is the CSS Gradient Generator?
This CSS gradient generator builds the three gradient functions supported by every modern browser: linear-gradient(), which blends colors along a straight line at any angle; radial-gradient(), which spreads outward from a center point as a circle or ellipse; and conic-gradient(), which sweeps colors around a center like a color wheel or pie chart. Each type can also be made repeating, which tiles the stop pattern to create stripes, rings and rays.
Color stops can be dragged on the bar, typed as HEX, rgb(), rgba(), hsl() or CSS color names, and reordered. Two stops at the same position create a hard edge instead of a blend, and stops with transparency fade smoothly because browsers interpolate premultiplied colors. The optional OKLab and OKLCH blending (CSS Color Level 4, written as "in oklab") avoids the muddy gray band you get when mixing complementary colors in sRGB.
The CSS output starts with a solid background-color fallback, the average color of the gradient, which shows if the gradient can't be rendered, followed by the background declaration. When OKLab or OKLCH is used, an extra sRGB line is added for older browsers. The Tailwind output uses an arbitrary value with spaces replaced by underscores, so it can be pasted directly into a class attribute. The PNG export renders the gradient pixel by pixel in your browser at the size you choose.
Frequently asked questions
- How does the angle of a linear gradient work?
- 0deg points up, 90deg points right and 180deg (the default) points down, rotating clockwise. The gradient line is sized so that the first and last colors reach the corners of the box, so the same angle can look different on boxes with different aspect ratios.
- How do I make a hard color stop without blending?
- Give two adjacent stops the same position, for example red at 50% and blue at 50%. The color changes instantly at that point. With a repeating gradient this technique produces stripes, as in the Pinstripe preset.
- What is the difference between circle and ellipse, and the size keywords?
- A circle has the same radius in both directions; an ellipse matches the box proportions. The size keyword sets where 100% ends: closest-side or farthest-side touch the nearest or farthest edge, and closest-corner or farthest-corner (the default) pass through a corner.
- Why use OKLab or OKLCH interpolation?
- Blending in sRGB often makes the midpoint dull: blue to yellow passes through gray. OKLab mixes in a perceptually uniform space, which gives even, natural transitions. OKLCH keeps saturation high by traveling around the hue wheel. Both need a 2023 or newer browser, so the generated CSS keeps an sRGB fallback.
- Does the Tailwind class work without configuration?
- Yes. Tailwind CSS v3.3+ and v4 accept arbitrary values such as bg-[linear-gradient(red,blue)] and output them as background-image. Inside the brackets, underscores stand for spaces, which class names can't contain.
- Are gradients better than background images for performance?
- Usually yes. A CSS gradient is a few bytes of text, needs no extra HTTP request, scales to any screen density without blurring and can be animated or themed with custom properties. Use the PNG export when you need the gradient outside the web, for example in slides or social images.
Related tools
- Image to WebPConvert PNG and JPEG images to lightweight WebP with adjustable quality, batch processing and ZIP download — no uploads.
- Image ResizerResize and compress JPG, PNG and WebP images by pixels or percentage, keep the aspect ratio and download in bulk. Nothing is uploaded.
- SVG OptimizerMinify and clean SVG files with SVGO directly in your browser. Compare sizes, preview the result and download the optimized SVG.
- Favicon GeneratorGenerate a complete favicon set (multi-size ICO, PNGs, Apple touch icon and web manifest) from an image, a letter or an emoji — entirely in your browser.
- Color ConverterConvert colors between HEX, RGB, HSL, HSV, CMYK and OKLCH, pick colors visually and generate shades, tints and color harmonies.
- Contrast CheckerCheck the contrast ratio between text and background colors against WCAG 2.2 AA and AAA, with live preview and suggested fixes.