Generate a Gradient From Two Colours – Free Online

A smooth gradient from two colours

A gradient is a smooth fade from one colour to another, and it is one of the easiest ways to make a website, a slide or a poster look modern. You pick the two end colours, and the computer fills in the steps between them. This tool builds that fade in RGB space, shows you a live preview, lists the middle colours, and gives you the CSS code to paste into your site.

The maths is simple. Each colour is three numbers: red, green and blue, each from 0 to 255. To find a step halfway between two colours, you take the halfway point of each number. Blue #1A73E8 is red 26, green 115, blue 232. Orange #FF8800 is red 255, green 136, blue 0. The halfway point is red 141, green 126, blue 116, which is a warm mauve.

How to use the generator

Type your first colour as a hex code, for example #1A73E8, and your second colour, for example #FF8800. Pick how many stops you want: 2 gives just the ends, 3 adds the middle, 5 and 7 give a smoother fade with more steps. Press the button and the tool shows the preview, the stop colours and the CSS line.

Copy the CSS line into your stylesheet or your design tool. It looks like this: linear-gradient(90deg, #1a73e8, #ff8800). The 90deg means the fade runs left to right. Change it to 180deg for a top to bottom fade, or to any angle you like. The bar under the result shows the two end colours side by side.

Worked example

Take blue #1A73E8 and orange #FF8800 with 3 stops. The stops are the start, the middle and the end. The start is #1a73e8. The middle is the halfway mix: red 26 to 255 gives 141, green 115 to 136 gives 126, blue 232 to 0 gives 116, so the middle is about #8d7e74. The end is #ff8800. That middle is a warm mauve, which is why blue to orange gradients often look soft in the centre.

Take black #000000 and white #ffffff with 3 stops. The middle is 0 to 255 halfway, which is 128 for each channel, so the middle is #808080, a perfect middle grey. Take red #FF0000 and blue #0000FF with 5 stops. The middle stop is #800080, a purple, and the two stops around it are #bf0040 and #4000bf. More stops give a smoother fade with no hard bands.

What makes a good gradient

Colours that are close in brightness make the smoothest gradients. Two light colours fade cleanly, and two dark colours fade cleanly. When the two ends are far apart in brightness, like black and yellow, the middle can look muddy or grey, because the halfway mix is neither colour. If your middle looks muddy, move the two ends closer together, or add a third colour in the middle by hand.

Contrast matters too. A gradient behind text must stay readable, so put dark text on a light gradient and light text on a dark one. Test the gradient at the real size it will be used: a gradient that looks smooth in a small preview can show bands when it is stretched across a full screen.

Honest limitations

This tool mixes colours in RGB space, which is the same maths browsers use for CSS gradients, but it is not the only way to mix colour. Designers sometimes mix in other colour spaces to keep the middle bright, and this tool does not do that. So a fade between two very different colours can look duller in the middle than you hoped.

The tool also gives you the CSS for a straight two-colour fade only. It does not build radial gradients, multi-colour rainbows or gradients with hard stops, and it does not check text contrast on the gradient. Use it to build the fade, then test it in your real design before you ship it.

Frequently asked questions

How do I use a gradient in CSS? Paste the line the tool gives you, like linear-gradient(90deg, #1a73e8, #ff8800), into a background or background-image rule. Change 90deg to 180deg for a top to bottom fade.

What is the middle colour of blue and orange? Between #1A73E8 and #FF8800 the middle is about #8d7e74, a warm mauve. The tool lists it when you pick 3 stops.

Why does my gradient look banded? A fade across a big area with too few steps shows bands. Use more stops, or add a tiny bit of noise in your design tool to break the bands up.

Can I use a 3-letter hex code? Yes. The tool expands #FFF to #FFFFFF and #F80 to #FF8800 before it mixes the colours.

También disponible en español: Generador de Degradado Desde Dos Colores – Gratis en Línea

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top