CSS Gradient Generator

CSS Gradient Generator: Master Linear, Radial, and Conic Gradients for Modern Web Design

3x
higher visual engagement for pages using gradients compared to flat single-colour backgrounds, per UX research

CSS gradients are one of the most powerful visual tools in web design, and they are often misused or underused in equal measure. A gradient applied without thought produces muddy, nauseating colour transitions. A gradient applied with care creates visual depth, guides the eye, and signals premium quality. The good news is that in 2026, CSS gradient support is essentially universal - no prefixes, no fallbacks, no JavaScript required. Every modern browser renders the full range of gradient types natively. This guide explains how each gradient type works, the CSS syntax behind it, design best practices, and how to use a CSS gradient generator to produce production-ready code in seconds.

01

CSS Gradient Fundamentals: Three Types to Know

CSS provides three gradient functions, each suited to different design use cases. Understanding which to reach for depends on the visual effect you are trying to achieve.

  • linear-gradient() - colour transitions along a straight line, from one point to another. The most common gradient type. Used for hero section backgrounds, button hover states, section dividers, and text fills. Syntax: `background: linear-gradient(direction, colour-stop-1, colour-stop-2, ...)`
  • radial-gradient() - colour radiates outward from a centre point in a circular or elliptical pattern. Used for spotlight effects, vignettes, card backgrounds, and focused attention effects. Syntax: `background: radial-gradient(shape size at position, colour-stop-1, colour-stop-2, ...)`
  • conic-gradient() - colour transitions rotate around a centre point, like the slices of a pie chart. Used for pie charts, colour wheels, progress indicators, and decorative circular effects. Syntax: `background: conic-gradient(from angle at position, colour-stop-1, colour-stop-2, ...)`
02

Linear Gradient Direction: Degrees and Keywords Explained

The direction of a linear gradient is the most important parameter after the colours themselves. CSS accepts two formats for direction: keyword values and degree values.

Keyword values are intuitive: `to right` transitions from left to right; `to bottom` transitions from top to bottom (the default); `to bottom right` transitions diagonally from top-left to bottom-right. These keywords are precise: `to right` is exactly 90 degrees. Degree values give you full control: `0deg` goes from bottom to top; `90deg` goes from left to right; `135deg` goes diagonally from top-right to bottom-left; `180deg` goes from top to bottom. The formula for converting keywords to degrees: `to top` = 0deg, `to right` = 90deg, `to bottom` = 180deg, `to left` = 270deg.

  • `background: linear-gradient(to right, #667eea, #764ba2)` - horizontal blue-to-purple sweep
  • `background: linear-gradient(135deg, #f5f7fa, #c3cfe2)` - diagonal light grey gradient
  • `background: linear-gradient(180deg, #0f0c29, #302b63, #24243e)` - three-stop dark purple vertical gradient
  • `background: linear-gradient(to bottom right, #43cea2, #185a9d)` - diagonal green-to-blue for hero sections
03

Multi-Stop Gradients: Adding Colour Complexity

Every gradient example so far has used two colour stops, but CSS gradients support any number of stops. Each stop can be positioned explicitly using a percentage or length value. Without explicit positioning, colour stops are distributed evenly across the gradient.

Explicit positioning gives you precision: `linear-gradient(to right, #ff0000 0%, #ff0000 30%, #ffff00 60%, #00ff00 100%)` holds red from 0% to 30%, then transitions to yellow at 60%, then transitions to green at 100%. This technique is how hard-stop gradients are created (two stops at the same position create a sharp colour boundary with no transition). A hard stop at 50% creates two solid colour blocks - the foundation of striped CSS backgrounds.

Pro Tip
When using more than three colour stops in a gradient, test the output at multiple background colours and on both light and dark mode settings. Complex gradients that look good on one background can look muddy or low-contrast in different contexts.
04

Browser Support in 2026: No Prefixes Needed

CSS gradients have had full, unprefixed support across all major browsers since 2013 for linear and radial gradients, and since 2019 for conic gradients. Global browser support for all three gradient types is above 98% in 2026, according to data at caniuse.com. You do not need vendor prefixes (-webkit-linear-gradient, -moz-linear-gradient) in new code. The standard syntax works everywhere.

The one exception worth noting: very old iOS Safari (pre-iOS 13) has incomplete conic-gradient support. If your analytics show a meaningful percentage of users on older iOS versions, consider providing a solid colour fallback before the conic-gradient declaration. For the vast majority of modern web projects, this is not a concern.

most common, directional transitions
Linear gradient
circular or elliptical, spotlight effects
Radial gradient
rotational, pie charts and colour wheels
Conic gradient
98%+
Browser support for all types
05

Gradient Design Tips: Colour Theory and WCAG Contrast

The technical capability to create any gradient does not mean every gradient looks good or works. Colour choice is where most gradient designs fail. Here are the principles that separate effective gradients from muddy ones.

  • Use colours that are adjacent on the colour wheel for smooth transitions. Blue-to-purple, orange-to-red, teal-to-blue. Complementary colours (directly opposite on the wheel) create muddy, brown-grey transitions in the middle unless you add an intermediate stop.
  • Keep saturation and lightness consistent across stops. A highly saturated colour transitioning to a desaturated colour creates a washed-out middle. Choose colours at similar saturation levels, or use HSL colour values where you can control saturation explicitly.
  • WCAG contrast for text over gradients. If your gradient is a background with text on top, the contrast ratio between the text colour and the background must be at least 4.5:1 for normal text and 3:1 for large text (WCAG AA standard). Because the background colour changes across the gradient, you need to check contrast at the lowest-contrast point of the gradient. Use the WCAG Contrast Checker at /tools/wcag-contrast-checker with the lightest part of your gradient background if your text is dark, or the darkest part if your text is light.
  • Two-colour gradients are almost always enough. Three stops can add sophistication. Four or more stops usually create visual noise. Start simple.
  • Match gradient direction to visual hierarchy. A top-to-bottom gradient on a hero section draws the eye downward toward the CTA. A left-to-right gradient on a navigation bar creates horizontal momentum. Let the direction reinforce the intended user flow.
06

Use Cases: Where Gradients Add Real Design Value

Gradients work well in specific contexts. Using them everywhere creates visual noise. Here is where they genuinely improve design.

  • Hero section backgrounds. A gradient background behind a headline and CTA creates depth and visual interest without adding image file weight. This is one of the performance advantages of CSS gradients over background images - there is nothing to load.
  • Call-to-action buttons. A subtle gradient on a button (slightly lighter at the top, slightly darker at the bottom) creates a three-dimensional appearance that signals interactivity better than a flat colour. This is a classic UI design pattern, dating to iOS skeuomorphic design, that still works because it maps to physical intuition about surfaces.
  • Card components. A gradient background on a card can distinguish it from the page background without requiring a border or shadow. A soft radial gradient can create a premium, tactile feel.
  • Section dividers and transitions. A gradient fade from the hero section colour to white creates a smoother page flow than an abrupt colour boundary.
  • Gradient text. CSS supports gradient fills on text via background-clip: text. Used for headings and display text, not body copy. Looks striking in dark-mode interfaces.
  • Borders using gradients. A gradient border (applied via background-image with border-box origin, or a pseudo-element technique) creates distinctive UI components like gradient-outlined cards and buttons.
07

CSS Gradient Performance vs. Background Images

CSS gradients have a significant performance advantage over background images: they require zero HTTP requests and have no file size. A CSS gradient background loads in microseconds as part of the stylesheet. A background image adds a request with its associated latency and file transfer time. For large hero sections, replacing a background image with a CSS gradient can meaningfully improve Largest Contentful Paint (LCP) - one of Google's Core Web Vitals. Check the impact on your actual LCP with the PageSpeed Checker at /tools/pagespeed-checker.

CSS gradients are rendered on the GPU, which makes them smooth and performant even when animated. A CSS gradient that changes over time (via a keyframe animation changing background-position on a oversized gradient) produces smooth 60fps animation without JavaScript. The performance profile of animated CSS gradients is significantly better than animated background images or canvas-based effects for simple colour transitions.

0
CSS gradient HTTP requests
1+
Background image HTTP requests
0 bytes
CSS gradient file size
50-300KB
Typical hero background image
💡
Key Insight
If you are replacing a background image with a CSS gradient for performance reasons, make sure the gradient maintains the same WCAG contrast ratio for any text that sits on top of it. A darker image background may have provided contrast that a lighter gradient does not. Use /tools/wcag-contrast-checker to verify.
08

Exporting and Using the CSS: Variables and Reuse

Once you have a gradient you like, using it consistently across a project requires a strategy. The most maintainable approach is CSS custom properties (variables). Define your gradient once as a variable and reference it everywhere:

`:root { --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }` Then reference it: `background: var(--gradient-hero);`. When you want to update the gradient, you change one line in your root declaration and every element that uses the variable updates automatically. This pattern is especially valuable when using the CSS Gradient Generator at /tools/css-gradient-generator - generate the code, then immediately define it as a CSS variable rather than pasting it inline everywhere.

09

How to Use the Searchlight CSS Gradient Generator

  1. Open the tool at seosearchlight.com/tools/css-gradient-generator
  2. Choose your gradient type: linear, radial, or conic
  3. Add colour stops by clicking the gradient bar and picking colours
  4. Adjust the direction using the angle dial (for linear) or position picker (for radial)
  5. Preview the gradient live in the output panel
  6. Add additional colour stops for multi-stop gradients
  7. Copy the generated CSS from the output - it is ready to paste into your stylesheet
  8. For WCAG compliance, check text contrast over the gradient using /tools/wcag-contrast-checker
Frequently Asked Questions

Free tool · no account needed

Try it free with Searchlight

Runs entirely in your browser. No uploads, no tracking, no paywall.

Generate Your CSS Gradient

Free · Browser-based · No sign-up required

Free tool
Try CSS Gradient Generator
Free, runs in your browser, no account needed.
Open CSS Gradient Generator
Tools directory

More free SEO and developer tools

All the tools covered in these guides - plus many more. Free, browser-based, no sign-up required.

SEO & AnalyticsView all →
Text & DataView all →
Encoders & DecodersView all →
GeneratorsView all →
ConvertersView all →
Image ToolsView all →
PDF ToolsView all →
Code ToolsView all →
Regex & Parsing
CalculatorsView all →
DiagramsView all →
Network & WebView all →
Text UtilitiesView all →
Color ToolsView all →
Diff & Compare

Tools across 15 categories - all free, all in your browser.

Browse all tools →