Gradient Color Generator
Gradient Color Generator
background: linear-gradient(90deg, #31A095 0%, #CE5F6A 100%);
Pick two colors and get every gradient color code in between (3–20 steps). Click any swatch to copy its code, or add a middle color for a three-color gradient. You also get a CSS gradient background with a live preview and code to copy, and the second tab makes tints, tones and shades of a single color. No time to pick colors? Choose one from the gradient chart below.
How to use the gradient generator
Two-color gradient
- Enter the Start color and End color. Any color code works (for example
#31A095,rgb(49, 160, 149)orred; see the color code converter for every format), or click the swatch next to the input to open the color picker. - Drag the slider to choose how many colors you want, start and end included (11 by default).
- Tick Add a middle color for a three-color gradient; click Swap colors to reverse it.
- If the middle looks grayish, tick Smoother blend (avoid a gray middle).
- Click any swatch to copy its HEX code, or Copy all color codes to copy the whole list separated by commas.
- Under CSS gradient background, choose linear or radial, set the angle and click Copy CSS to paste it into your stylesheet.
Tints, tones and shades
Enter one base color to get three rows:
- Tints mix the color with white, so it gets lighter step by step. Good for backgrounds and light labels.
- Tones mix it with gray (#808080), so it becomes softer and less saturated: the muted, dusty colors that are popular in interior and fashion palettes.
- Shades mix it with black, so it gets darker. Good for text, borders and pressed buttons.
Gradient color chart
Popular two- and three-color gradients. Click one to load it into the generator above, then change the number of colors or copy the CSS.
How gradient color codes are calculated
A gradient simply spaces the R, G and B values evenly between the start and end colors. For n colors (start and end included), color number i (counting from 0) is:
color = start + (end − start) × i ÷ (n − 1), calculated separately for R, G and B and rounded
For #31A095 (RGB 49, 160, 149) to white #FFFFFF in 11 colors, the R of the first in-between color is 49 + (255 − 49) × 1 ÷ 10 = 69.6, rounded to 70, or 46 in hexadecimal. G and B work out to AA and A0, giving #46AAA0. To convert between decimal and hex, use the color code converter.
Avoiding a gray middle: smoother blend (OKLab)
The further apart two colors are on the color wheel (the closer to complementary colors), the grayer the middle of an even RGB gradient becomes; the FAQ below explains why. With Smoother blend (avoid a gray middle) ticked, the generator blends in the OKLab color space instead. OKLab is designed around how the eye sees color, so the in-between colors keep more of their saturation: from #31A095 to #CE5F6A the middle changes from gray #808080 to a warm #978680. Other fixes: add a middle color, or choose two colors with closer hues.
CSS gradient syntax
/* Linear gradient: 90deg runs left to right, 180deg top to bottom */
background: linear-gradient(90deg, #31A095 0%, #CE5F6A 100%);
/* Three colors: the middle color at 50% */
background: linear-gradient(90deg, #31A095 0%, #F5E6A8 50%, #CE5F6A 100%);
/* Radial gradient: from the center outwards */
background: radial-gradient(circle, #31A095 0%, #CE5F6A 100%);
0deg runs bottom to top, 90deg left to right and 180deg top to bottom. The percentages are where each color sits; move them to change the balance, for example #31A095 30% gives the start color more room. With the smoother blend ticked, the generator writes every in-between color into the CSS so all browsers show the same result.
FAQ
What are gradient color codes?
They are the color codes of each step when one color changes gradually into another, usually written in HEX such as #31A095. You can use them for consistent light-to-dark palettes in web pages, slides and charts, or turn them into a CSS gradient background.
How do I choose colors for a nice gradient?
The easiest way is two colors from the same family or with neighboring hues (blue to purple, orange to yellow), which blend naturally. For strong contrast you can use complementary colors, but tick the smoother blend or add a middle color so the middle does not turn gray. You can also start from the gradient chart and adjust it.
What is the difference between tints, tones and shades?
A tint is a color mixed with white, so it gets lighter; a tone is mixed with gray, so it becomes softer and less saturated; a shade is mixed with black, so it gets darker. Design systems often build a full range from one brand color: the base color for buttons, a tint on hover and a shade when pressed.
How many gradient colors can I make?
From 3 to 20 per gradient, start and end included, set with the slider. For more, use one of the in-between colors as a new start color and make another gradient.
Why does the middle of a two-color gradient turn gray?
When RGB values are averaged, complementary colors cancel each other out and the middle turns gray: halfway between teal #31A095 and red #CE5F6A is exactly gray #808080. Ticking the smoother blend, which uses the OKLab color space, or adding a middle color fixes it.
How do I write a gradient background in CSS?
Use the background property with linear-gradient or radial-gradient, for example background: linear-gradient(90deg, #31A095 0%, #CE5F6A 100%); for a left-to-right gradient from teal to red. This generator lets you set the angle, preview the result and copy the CSS.