Skip to content
induwara.lk
induwara.lkDeveloper · Browser-only

CSS Gradient Generator, Linear, Radial & Conic

Build a CSS gradient visually. Pick linear, radial, or conic, drop colour stops, drag the angle, and copy the generated CSS or Tailwind v4 utility. Runs entirely in your browser, no upload, no signup.

By Induwara AshinsanaUpdated May 11, 2026
CSS gradient generatorlinear · radial · conic
°
Quick angles
  1. %
  2. %

Stops auto-sort by position when the CSS is generated. Two stops at the same position create a hard-edge transition.

Presets

Sources: W3C CSS Images 3 · CSS Images 4 (conic) · verified 2026-05-11

How it works

The tool keeps every gradient as a structured config in memory, type, orientation (angle or shape-and-position), a list of colour stops, and a repeating flag. Every time you change a control, the config is re-serialised to a CSS gradient function value via a small pure module. The same string is fed into the preview swatch's inline style and into the read-only output box, so what you see is exactly what you copy.

Linear gradients. CSS syntax: linear-gradient(<angle>deg, <stop>, <stop>…). An angle of 0° points to the top, 90° to the right, 180° to the bottom, 270° to the left, the same compass convention CSS Images Module Level 3 §3.1 uses. The starting point sits on the painting area edge that the angle vector originates from; the colour line runs across the area along the vector and back. Hard stops (two stops at the same position) produce zero-width transitions.

Radial gradients. CSS syntax: radial-gradient(<shape> <size> at <pos>, <stop>…). The shape is circle or ellipse. The size keyword tells the browser which edge or corner of the painting area sets the 100% stop, closest-side, closest-corner, farthest-side, or farthest-corner. The position is the centre of the gradient, in percent of the box (50% 50% is dead-centre). The same precedence is normative in CSS Images 3 §3.2.

Conic gradients. CSS syntax: conic-gradient(from <angle>deg at <pos>, <stop>…). Stops are painted around the centre by angle rather than by distance. 0% is at the starting angle (default: 12 o'clock, 0°) and progresses clockwise. Conic gradients are the easiest way to render a pie-chart segment or a colour wheel without an SVG. The function was added in CSS Images Module Level 4 §4.3 and ships in every modern browser today.

Repeating variants. Prefix the function name with repeating- and the stop list tiles across the entire painting area. The last stop's position becomes the tile size, so for a repeating linear at 45° with stops at 0%, 10%, 10%, 20%, you get sharp stripes one-fifth of the diagonal apart. Use the “Striped” preset to see this in action.

Output formats. The generator emits three formats. The default is a single background: declaration. The “With fallback” option adds a solid-colour line above the gradient, so old browsers and HTML-email clients still get a readable background. The “Tailwind v4” option emits a bg-[image:…] arbitrary value that drops straight into a JSX className, escaping is handled for you.

Every output is silently round-trip verified on load, the eight built-in presets are emitted via the serialiser, parsed back via a small companion parser, and compared stop-by-stop. The badge in the editor header confirms the check passes. Same credibility guarantee shipped with the JSON formatter and colour converter elsewhere on this site.

Worked examples

Two-stop linear, 180° (top → bottom)

Default gradient orientation. 180° means start at the top, end at the bottom.

  1. Stop 1: #000000 at 0%
  2. Stop 2: #FFFFFF at 100%
  3. Angle: 180°
  4. CSS: background: linear-gradient(180deg, #000000 0%, #FFFFFF 100%);
  5. Notes: Standard greyscale fade. 0deg points to the top; 180deg points to the bottom. CSS Images 3 §3.1.

Hard-stop diagonal split, 45°

Two colours separated by a zero-width transition. The classic hard-stop trick.

  1. Stop 1: #FF0000 at 0%
  2. Stop 2: #FF0000 at 50%
  3. Stop 3: #0000FF at 50%
  4. Stop 4: #0000FF at 100%
  5. CSS: background: linear-gradient(45deg, #FF0000 0%, #FF0000 50%, #0000FF 50%, #0000FF 100%);
  6. Notes: Two stops at the same position create a sharp colour edge. Use repeating- to tile this into stripes.

Radial sapphire halo (centre)

Saffron core fading to deep sapphire, site brand palette as a radial.

  1. Shape: circle, farthest-corner
  2. Centre: 50% 50%
  3. Stop 1: #F39C12 at 0%
  4. Stop 2: #1A4FB8 at 70%
  5. Stop 3: #0D2A56 at 100%
  6. CSS: background: radial-gradient(circle farthest-corner at 50% 50%, #F39C12 0%, #1A4FB8 70%, #0D2A56 100%);
  7. Notes: farthest-corner ensures the gradient reaches the box corners, so the third stop is visible.

Conic colour wheel (edge case: closed loop)

A full hue circle. Duplicate the first colour at 100% to close the loop seamlessly.

  1. From: 0deg at 50% 50%
  2. Stop 1: #FF0000 at 0%
  3. Stop 2: #FFFF00 at 16.67%
  4. Stop 3: #00FF00 at 33.33%
  5. Stop 4: #00FFFF at 50%
  6. Stop 5: #0000FF at 66.67%
  7. Stop 6: #FF00FF at 83.33%
  8. Stop 7: #FF0000 at 100%
  9. Notes: Without the duplicate red at 100%, the wheel would jump from magenta back to red at the seam.

Frequently asked questions

Sources & references

Specifications last reviewed on 2026-05-11. CSS Images Module Level 4 is a Working Draft, when it advances and the conic syntax changes, this page is re-verified.

Related tools

Comments & feedback

Spotted a bug or want an improvement? Tell us, our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] , most fixes ship within 24 hours.