Gradients are everywhere in modern web design: behind hero headings, across buttons, inside cards, as subtle background washes. Their popularity is easy to understand. A flat colour can feel stark, while a gradient adds depth, direction and warmth with a single CSS declaration. Their danger is equally easy to understand. A gradient built from colours that clash, or that pass through an ugly intermediate shade, looks cheap in a way that flat colour never does. The eye is remarkably sensitive to colour transitions, and a muddy middle is the first thing it notices.

The CSS Gradient Generator lets you build gradients deliberately. You pick the gradient type, the angle, and two or three colours, preview the result, and copy the background CSS for your own site. The preview is the whole point: colour blends are visual facts, not numerical ones, and a combination that sounds good in words — "blue to orange" — may pass through a murky brown in practice that only the preview reveals.

How the tool works

A linear gradient blends colours along a straight line. You choose the angle of that line — for example, 135 degrees, which runs diagonally from the top-left toward the bottom-right — and the colours at each end, with optional colour stops in between. The browser interpolates smoothly between each pair of stops, so a gradient from colour A to colour B contains every shade between them, in order. A radial gradient blends outward from a centre point instead, which suits glows, spotlights and circular decorations.

Two-colour gradients are the simplest and often the best choice: they produce a clean, predictable blend, especially when the two colours are neighbours on the colour wheel or different shades of the same hue. Three-colour gradients add a middle stop, which gives you control over the journey: you can route the blend through a chosen middle colour instead of letting the browser's interpolation decide the intermediate shades for you. That control is what separates a deliberate gradient from an accidental one.

Colour stops can also carry positions, such as percentages along the gradient line. By default, stops are spaced evenly, but moving a stop changes where each colour dominates. Placing the middle colour closer to one end, for example, makes the gradient spend more of its length in the other colour's territory. The generator's preview shows these shifts immediately, which is far faster than editing percentages blind.

A worked example

Suppose you want a hero background that moves from a deep teal at the top-left to a warm amber at the bottom-right, passing through a soft green in the middle. You choose a linear gradient at 135 degrees, with three sample colours: deep teal, a mid green, and warm amber. Without the middle green, the direct blend from teal to amber would pass through desaturated, greyish tones, because the interpolation between two distant hues crosses the dull centre of the colour space. With the green stop in the middle, the blend travels teal to green to amber, staying vivid throughout, like a landscape moving from water to grass to sunlight.

In the preview, you check three things. First, the overall direction: does the diagonal feel balanced, or does one corner dominate? An angle of 135 degrees suits a wide hero section; a steeper or shallower angle may suit a tall card better. Second, the middle: does the green read as a deliberate waypoint, or does it form a visible band? If the middle colour forms a harsh stripe, move its stop position or choose a green closer to its neighbours. Third, the text: if a heading will sit on the gradient, is it readable at every point along the blend, or does it vanish where the gradient is lightest? A gradient that looks beautiful empty can fail the moment text is added, and the fix is usually to darken the gradient overall, add a subtle overlay, or place the text where the gradient is darkest.

A second, quieter example is worth noting: a subtle gradient for a card background, from a very light grey to white, at 180 degrees, straight downward. The blend is barely perceptible, and that is the point. It gives the card a faint sense of light falling from above, without competing with its content. Not every gradient needs to be vivid. The most professional gradients are often the ones a visitor never consciously notices.

Common mistakes

The first mistake is choosing colours that are too far apart without a middle stop. The browser's interpolation is mathematically even but not perceptually even, and distant hues produce muddy middles. Either choose neighbouring colours, or add a middle stop that routes the blend through a pleasant intermediate.

The second mistake is ignoring contrast. Text on a gradient must be readable against every part of the gradient it overlaps, not just against its average colour. Test headings and buttons at each end and in the middle, and if any part fails, adjust the gradient or the text colour until all parts pass.

The third mistake is using gradients everywhere. A page where the background, the cards, the buttons and the headings all carry vivid gradients has no resting place for the eye, and the gradients cancel each other out. Choose one or two gradient moments per page — typically the hero and the primary call to action — and let the rest of the page stay flat.

The fourth mistake is copying a gradient's CSS without its fallback. Older browsers or unusual contexts may not render a gradient, and a page that depends on it for contrast can break. Include a solid background colour before the gradient declaration, so that if the gradient fails, the fallback still provides a sensible background.

Honest limitations

A gradient generator previews colours on your screen, under your lighting, on your display. Colours shift between displays, in print, and for viewers with colour vision differences, so a gradient that looks perfect to you may look different to someone else. The generator also cannot judge whether a gradient suits your brand, your content, or your audience. It produces the blend you asked for; the decision that the blend belongs on your page is a design judgement, not a technical one. Finally, gradients are decoration. They do not improve content, navigation or performance, and a page with weak content will not be saved by a beautiful background.

Closing

Choose neighbouring colours or a deliberate middle stop, preview at the angle and size you will actually use, test text contrast across the whole blend, and reserve vivid gradients for one or two moments per page. To convert the colours in your gradient to other formats, try the Colour Converter, and to pick exact shades, see the Color Code Picker. For making sure your gradient choices stay readable for everyone, read Charts Everyone Can Read: Colour, Labels, and Accessibility.