Skip to main content

developer tool

CSS Gradient Generator

Create CSS linear and radial gradients with live previews. Choose colors, adjust angles and stop positions, try presets and copy the generated CSS.

Loading tool…

Guide

CSS Gradient Generator online

Use the CSS Gradient Generator to build a background from two to ten opaque HEX colors. Switch between a directional linear gradient and an outward-spreading radial gradient, then adjust stops while watching the live preview. Generation runs in your browser without sending input colors to a processing service. Copy a complete background declaration when the design is ready.

How to Create a CSS Gradient

1

Choose a gradient type

Select Linear for a directional blend or Radial for a blend radiating from a point. Start from the default colors or apply a local preset.

2

Edit the color stops

Enter three- or six-digit HEX colors or use the native color pickers. Set each position between 0% and 100%, add up to ten stops or remove stops while keeping at least two.

3

Adjust settings and preview

For linear gradients, set an angle from 0° to 360°. For radial gradients, choose circle or ellipse and center, top, bottom, left or right. Check how the preview changes.

4

Copy the CSS

Use Copy CSS and paste the declaration inside a CSS selector in your stylesheet. Test the background at its actual size and verify contrast wherever text overlaps it.

Linear vs Radial Gradients

A CSS linear gradient changes colors along a straight axis, making it useful for directional backgrounds and subtle bands. A radial gradient expands from a chosen origin. Circle uses a circular ending shape; ellipse adapts its radii to the element. This CSS Radial Gradient Generator uses the default farthest-corner size and offers five origin positions.

Understanding CSS Gradient Angles

CSS angles start with 0deg pointing upward and increase clockwise: 90deg points right, 180deg down and 270deg left. At 360deg the direction returns upward. The first stop starts toward the opposite end of the gradient line, and the final stop lies toward the direction the angle points. A 135deg linear gradient therefore progresses toward the lower right.

How Color Stops Work

A stop pairs a color with a percentage along the gradient. A 0% stop begins the gradient and a 100% stop ends it; intervening stops control where blends meet. In radial gradients, percentages follow the radial gradient line rather than a simple horizontal width. Equal positions can create hard edges. The editor preserves displayed order. If a position decreases, CSS fixes it to the preceding highest position, and the editor shows a warning instead of sorting your colors.

Using Gradients as CSS Backgrounds

The generated declaration uses background: linear-gradient(...) or background: radial-gradient(...). Put it inside a rule such as .hero { ... } and give the element dimensions through its content or layout styles. The background shorthand resets other background properties; use background-image with the gradient value instead if you need to preserve separately configured background properties. A separate background-color can provide a solid fallback.

Responsive Gradient Design

Gradients are rendered by CSS and scale with the painted element without downloading an image. Their visual balance still changes with the element's aspect ratio. Review wide banners and narrow mobile cards separately; a circle and an ellipse can fill the same rectangle quite differently. Percentage stops keep their relative placement along the gradient line, but do not guarantee the same color behind a heading at every screen size.

Gradient Accessibility and Contrast

Check text against every background color it overlaps, including intermediate blends and responsive layouts. Testing the endpoint colors alone may miss the weakest area. Consider a solid text panel or an overlay when the background varies too much. The related Color Contrast Checker evaluates solid color pairs; it does not certify an entire gradient or website. This generator does not calculate a gradient-wide accessibility score.

Copying Generated CSS into a Website

Copy CSS copies a complete declaration with a trailing semicolon. Paste it inside a selector in a stylesheet or a style block, rather than inserting it as HTML. In a JavaScript style object, use the gradient value as the background property string. Invalid or incomplete entries pause the preview and disable copying until corrected. If clipboard access is blocked, select the code and copy it manually.

Presets and Supported Colors

Sunset, Ocean, Aurora, Lavender, Forest and Sunrise apply actual editor settings so you can continue editing the result. This Online Gradient Maker supports opaque three- and six-digit HEX colors, normalizing shorthand and letter case. Alpha HEX, named colors, repeating gradients and additional CSS color spaces are outside this version. Reset restores the original three-stop Sunset gradient.

Common uses for CSS Gradient Generator

  • Designing hero and card backgrounds
  • Trying directional color transitions for a landing page
  • Building radial highlights behind decorative elements
  • Sharing a reusable CSS background declaration with a developer

Why use this developer tool?

  • Preview linear and radial CSS backgrounds as you edit.
  • Keep control of two to ten color stops without automatic reordering.
  • Apply six editable presets without a processing upload.
  • Copy validated CSS or select it manually if clipboard access is unavailable.

CSS Gradient Generator FAQ

What is a CSS gradient?

A CSS gradient is an image generated by the browser that transitions between two or more colors. It can be used as a background without a separate image file.

How do I create a linear gradient in CSS?

Choose Linear, set an angle and edit at least two color stops. For example, background: linear-gradient(90deg, #000000 0%, #FFFFFF 100%); blends from black on the left to white on the right.

What is the difference between linear and radial gradients?

Linear gradients blend along a straight directional axis. Radial gradients spread outward from an origin using a circle or ellipse.

How do I change the gradient angle?

In Linear mode, move the angle slider from 0° to 360°. CSS uses clockwise angles, with 0° pointing up and 90° pointing right. Radial gradients use shape and position controls instead.

Can I use more than two colors?

Yes. Add up to ten color stops, each with its own opaque HEX color and percentage position. At least two stops must remain.

How do CSS color stops work?

Stops specify where colors sit along the gradient line. The editor preserves displayed order. Equal positions make sharp edges; decreasing positions are treated by CSS as the preceding highest position, with a warning in the editor.

Can I copy the generated CSS?

Yes. Copy CSS copies a complete background declaration when all inputs are valid. If clipboard permission is unavailable, select the displayed code and copy it manually.

Are CSS gradients supported by modern browsers?

Standard linear-gradient() and radial-gradient() syntax works in modern browsers. Test your actual layout and target browsers, and provide a solid background color when a fallback is needed.

Is the CSS Gradient Generator free?

Yes. The editor, presets, preview and CSS copying are free and require no signup.

Can I use generated gradients in commercial websites?

Yes. You can use the generated CSS declarations in personal and commercial websites. Review the colors and text contrast in your final design.

Related Tools