SVG Gradient Generator (linearGradient & radialGradient)
Generate SVG <defs> markup with linearGradient or radialGradient, multiple stops and angle control. Preview live and copy clean, valid SVG code.
Preview
Gradient
Stops (offset %)
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="240" viewBox="0 0 400 240">
<defs>
<linearGradient id="brand-gradient" x1="0%" y1="50%" x2="100%" y2="50%">
<stop offset="0%" stop-color="#2563EB" />
<stop offset="100%" stop-color="#10B981" />
</linearGradient>
</defs>
<rect width="400" height="240" fill="url(#brand-gradient)" />
</svg>Technical Specification & Mathematical Principles
How the SVG Gradient Generator Works
SVG gradients are defined inside <defs> and referenced with fill="url(#id)". A <linearGradient> uses x1, y1, x2 and y2 to define the vector along which stops are interpolated. This tool converts a CSS angle (0 degrees = to top, clockwise) into that vector on the object bounding box: dx = cos(angle - 90) / 2 and dy = sin(angle - 90) / 2, centered at 50% 50%.
A <radialGradient> uses cx, cy and r for the center and radius. Each <stop> has an offset and a stop-color. Because the markup is vector data, it is resolution independent and can be inlined in HTML, saved as a .svg file or used in a CSS data URI.
Frequently Asked Questions
Why use SVG gradients instead of CSS gradients?
Why must gradient ids be unique?
How do I add opacity to a stop?
Related Design & Color Instruments
CSS Gradient Maker
Design linear and radial CSS gradients with 360-degree angle control, multi-stop adjustments, and instant code export.
Linear Gradient Tool
Visual builder for CSS linear-gradient() with multi-stop drag controls, angle wheel, and instant CSS snippet.
Radial Gradient Tool
Visual builder for CSS radial-gradient() with circle/ellipse shapes, position coordinates, and color stops.
Conic Gradient Generator
Design CSS conic-gradient() color wheels with starting angle, center position and color stops. Includes a repeating mode and copy-ready CSS output.