CSS Gradient Generator

Pick colors and an angle to get CSS linear-gradient or radial-gradient code.

Your colors are placed at equal spacing and written as one CSS background line. The preview and code update in the page; press Copy CSS when you are done. Conic gradients are not supported.

The Linear tab has 8 direction buttons and a 0 to 360 angle slider. The default is 90 degrees with #667eea and #764ba2.

DirectionAngleCode
Up0linear-gradient(0deg, #667eea, #764ba2)
Right (default)90linear-gradient(90deg, #667eea, #764ba2)
Down right135linear-gradient(135deg, #667eea, #764ba2)
Down180linear-gradient(180deg, #667eea, #764ba2)
Up left315linear-gradient(315deg, #667eea, #764ba2)

0 degrees runs bottom to top, 90 runs left to right, and larger values turn clockwise. In a box that is not square, 135deg is a fixed 45-degree diagonal while to bottom right aims at the corner. Switch to the keyword if the gradient must reach the corner exactly.

Why blue to yellow turns gray

Browsers mix sRGB numbers directly, so #0000ff to #ffff00 passes through a gray near 128, 128, 128, and #ff0000 to #00ff00 passes through dark olive. Add a stop in the middle, such as #00c0c0 or #ffff00, with + Add Color. New stops start as white, you cannot delete below two, and the hex field accepts only # plus six digits.

The Radial tab lets you choose Circle or Ellipse. Stops are always evenly spaced, so to move a stop or make a hard stripe, edit the copied code: #667eea 20% or #f00 50%, #00f 50%. If text sits over the gradient, test the lightest and darkest ends in the contrast checker.