CSS Gradient Generator

Create a two-color linear or radial CSS gradient with HEX inputs, a live preview and copyable CSS. Includes direction and usage guidance.

← Image & Design Tools

Build a two-color CSS linear or radial gradient and copy the generated CSS.

CSSColorBrowser processing

How to make a gradient

  1. Choose Linear or Radial.
  2. Pick two colors or enter 3- or 6-digit HEX values.
  3. For a linear gradient, enter a whole-number angle from 0 to 360.
  4. Review the preview and copy the CSS declaration.

The output updates as you edit. Invalid input clears the preview and disables Copy CSS until corrected. Radial gradients ignore the angle control.

Generated output

The tool returns a standard CSS background declaration for the selected gradient type and colors.

Privacy

Gradient generation happens locally in your browser.

Understanding the direction

For linear gradients, 0 degrees runs from bottom to top, 90 degrees from left to right, and 180 degrees from top to bottom. 360 degrees has the same direction as zero. The radial option creates a circle centered in the element, with the first color at the center and the second toward the outer edge.

Using the CSS on your page

Paste the declaration inside a selector, such as .card { background: linear-gradient(90deg, #4F46E5, #06B6D4); }. The background shorthand can reset other background settings, so review any existing images, positions or repeat rules.

This tool uses two opaque colors with default color-stop positions. It does not generate repeating or conic gradients, custom stops, transparency or downloadable images. The gradient adapts to the target element’s dimensions, so test it at the sizes used in your design.

Text over a gradient can have different contrast at different positions. Use the Color Contrast Checker to inspect relevant solid-color pairs and test the final rendered design. See MDN’s CSS gradients guide for more options.

Related tools