CSS Gradient Builder

Build linear, radial, and conic CSS gradients with a visual editor. Drag color stops, pick presets, and copy ready-to-use CSS, Tailwind, or custom property output.

ZERO UPLOAD · ALL LOCAL

What this page covers

  • background-clip: text needs the -webkit- prefixed version too for older WebKit builds
  • background-size: 200% 100% required for the shimmer animation technique
  • Contrast check at both ends gradient text can pass WCAG at one end and fail at the other

What this page covers

  • @property registration required to animate gradient stop colors directly
  • background-position-x animation the no-@property fallback that works in all modern browsers

What this page covers

  • 3 to 6 gradient layers fewer looks like a flat two-tone blend, more adds cost without visible improvement
  • Transparent outer stops each radial-gradient layer must fade to transparent at its edge for layers below to show through

What this page covers

  • bg-linear-to-r replaces the v3 bg-gradient-to-r class
  • /oklch modifier appended to the gradient type class to route interpolation through OKLCH

What this page covers

  • border-image-slice: 1 tells the browser to use the gradient without slicing or tiling
  • background-clip masking the technique needed for rounded gradient borders, since border-image ignores border-radius

What this page covers

  • in oklch modifier routes interpolation through the OKLCH perceptual color space
  • Browser support Chrome 111+, Edge 111+, Firefox 113+, Safari 16.4+

What this page covers

  • Dark-surface lightness range 0.15 to 0.35 in oklch terms avoids the neon look
  • Dark-surface chroma range 0.05 to 0.15 in oklch terms

What this page covers

  • Tile length equals the last stop position minus the first stop position
  • Dot spacing controlled by background-size, independent of the stop percentages

What this page covers

  • Tint alpha range 0.05 to 0.4 overall, 0.10 to 0.20 for a light glass effect, 0.25 to 0.35 for a stronger tint
  • backdrop-filter: blur() needs the -webkit- prefix for Safari alongside the standard property

What this page covers

  • Copy icon location Design panel > Fill row (not the Code panel), visible only on hover
  • Linear / Radial / Angular map to linear-gradient(), radial-gradient(), and conic-gradient() respectively
  • HEX-only export OKLCH, HSL, and P3 colors all flatten to sRGB HEX approximations on export
  • Angular stop-to-degree mapping a 50% stop in Figma's Angular fill equals 180deg in the CSS conic sweep

What this page covers

  • v4 utility rename bg-gradient-to-* (v3) becomes bg-linear-to-*, bg-radial, and bg-conic (v4)
  • Stop modifiers from-*, via-*, and to-* accept any color token in the palette
  • OKLCH interpolation the /oklch modifier avoids the grey sRGB midpoint between distant hues
  • Dynamic stops JIT cannot detect runtime-constructed class names, so dynamic colors need a CSS custom property instead

What this page covers

  • globals.css shared, site-wide gradient classes, imported once in the root layout or _app.tsx
  • CSS Modules + composes component-scoped gradients that inherit from a shared design-tokens module without duplication
  • Inline style prop necessary when the gradient value changes based on props or fetched data
  • Dark mode adaptation custom properties redefined inside @media (prefers-color-scheme: dark) update the gradient with no JavaScript

What this page covers

  • Scoped style blocks Svelte adds a unique attribute (e.g. svelte-abc123) to elements and selectors at compile time, at zero runtime cost
  • :global() selector escapes component scoping when a gradient must apply outside the component
  • Reactive syntax Svelte 4 uses $: gradient = ...; Svelte 5 replaces it with const gradient = $derived(...)
  • Dynamic stops via props pass colors as props, set them as CSS custom properties in the style attribute, reference with var()

What this page covers

  • <style scoped> adds a unique data attribute to both elements and selectors at compile time, isolating the gradient to the component
  • :deep() selector needed to target a child component's root element, since scoped attributes don't propagate to children
  • v-bind() in CSS Vue 3.2+ only; injects a reactive ref directly into a CSS property via a hashed custom property
  • computed() gradient strings assembles a multi-stop gradient from several refs, ideal for a reusable useGradient composable

What this page covers

  • Template literal syntax gradient CSS written directly inside a styled.div backtick string, compiled to a hashed class at runtime
  • css helper required as soon as a gradient fragment contains theme or prop interpolation; a plain string suffices for fully static values
  • ThemeProvider tokens \${({ theme }) => theme.colors.x} pulls gradient stops from the active theme via React context
  • Props-based switching styled-components regenerates and caches a class per distinct prop combination

What to look for

  • math.div($index - 1, $total - 1) * 100%
  • 0%
  • 50%
  • 100%

Optional mixin parameters (like a $via midpoint stop) should default to null so existing @include call sites keep working unchanged as the mixin grows.

What this page covers

  • Direction keyword defaults to to bottom when omitted
  • Angle units deg, rad, grad, and turn are all accepted and resolve to the same position
  • Hard stops two stops at the same position produce a sharp edge with no blend

What this page covers

  • circle keyword forces equal horizontal and vertical radii
  • at position sets the focal point, for example at 25% 75%
  • closest-side sizing the gradient edge reaches the nearest side instead of the farthest corner

What this page covers

  • Hard stops for example blue 40%, orange 40% for a sharp segment boundary
  • Angle-value stops stops can be written in degrees instead of percentages
  • in oklch hue sweep routes a full hue sweep through the OKLCH space

What this page covers

  • Explicit stop positions required, omitting them produces undefined tile length across browsers
  • Hard-stop pairs for example blue 0px, blue 15px, white 15px, white 30px tiles a 30px stripe

What this page covers

  • Two-value stop shorthand black 0deg 90deg is shorthand for two separate stops
  • 90-degree hard stops tile twice around the center for a four-quadrant checkerboard

What this page covers

  • Color hint a bare position value that shifts the interpolation midpoint between two stops
  • Two-position shorthand blue 20% 60% renders solid blue between the two positions
  • Mixed length units a single gradient can mix percent, px, and calc() across its stops
Gradient Type
Presets
Color Stops
0 50 100
Angle
135° deg
Output (Gradient preview and code)
 
  1. Choose a gradient type with the Linear / Radial / Conic toggle, or click a preset to load a starting point.
  2. Click anywhere on the gradient track to add a color stop, then drag it left or right to reposition it.
  3. Click a handle to select it, then type any CSS color format (HEX, RGB, HSL, or OKLCH) into the color field, or click the swatch to open the builder's visual picker with its hue, saturation, and opacity controls.
  4. Drag the angle dial to rotate a linear gradient or set the starting angle for a conic gradient. For radial and conic types, set the center position with the X and Y inputs.
  5. Choose CSS, Tailwind, or Vars in the output panel and click Copy to grab the result.

Linear, radial, and conic: when to use each

Choosing the right gradient type is a geometry decision, not a color one. Linear gradients draw a straight transition between stops along a single axis, making them the standard choice for background fills, hero sections, button hover states, and text overlays where direction carries visual weight. Radial gradients expand outward from a focal point, which is a behavior that suits spotlight effects, vignette darkening around the edges of a photograph, and soft circular highlights on cards or surfaces.1

Conic gradients rotate color around a center point, the way a clock face sweeps through hours. That rotation makes them the natural tool for pie charts, color wheels, starburst patterns, and any decorative element where color should appear to spin rather than flow in a line. For most backgrounds and overlays, start with linear. When you need a glow or vignette centered on a specific point, switch to radial. When the effect requires rotation, conic is the right type.1

Choosing by geometry and intent

A quick way to decide is to ask what the gradient is supposed to mimic. A smooth wash across a hero section reads as directional light, which calls for a linear gradient. A soft pool of light behind a subject reads as radiation from a point, so radial is the better fit. A ring of distinct color segments reads as rotation around a hub, which is the signature behavior of a conic gradient. Once you name the visual behavior, the gradient type follows directly, and you can always switch types later without losing your color stops.

Mesh gradients: layering radials

A mesh gradient, the kind that blends several color sources across a whole surface in two dimensions, has no single CSS function. The three functions each draw along one dimension: linear draws along an axis, radial draws from one point, and conic draws around one center. The technique that produces a mesh is layering multiple radial gradients, each with its own transparent fade, as comma-separated backgrounds on one element. The topmost layers read through their own transparent regions, and the overlapping pools of color add up to the two-directional blend a mesh implies.

Each radial layer builds exactly like a single gradient here: choose the center, set the stops, use the per-stop opacity for the fade toward nothing, and copy the CSS. The boundary is one gradient function per output, so assembling the layered declaration is the hand edit, with each layer's function copied from its own build. The first function in the comma list paints on top, so order the layers deliberately and let the transparent stops reveal what sits beneath. The mesh emerges from the stack rather than from any single function.

How CSS color stop interpolation actually works

Between every two color stops, CSS gradients interpolate through the active interpolation color space. By default, that space is Oklab unless you specify another method such as in srgb or in oklch. At the midpoint between a red stop at 0% and a blue stop at 100%, the rendered color is the midpoint of the two colors in that active space. That midpoint is not fixed; you can shift it by inserting a hint stop, which is a position-only value with no color of its own. A hint stop at 30% tells the browser to reach the midpoint of the blend at 30% of the distance between the two color stops rather than at the mathematical center.23

Gradient builder with a linear gradient at 135 degrees from #667eea to #764ba2 and the generated CSS below the preview
The default linear gradient: two stops, #667eea at 0% and #764ba2 at 100%, at 135°. The CSS tab outputs background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

One honest note about hint stops and this editor. Every stop in the builder carries a color and an opacity, so a position-only hint stop cannot be expressed here at all. Shifting the blend inside the tool means inserting a color stop near the desired midpoint, which is exactly what the track's click-to-add does, and nudging its color toward the side you want to favor. When a true midpoint marker is the goal, the hint syntax itself is a hand edit on the copied output: add the bare percentage at the point where the blend should reach its midpoint, and the browser honors it.

Hard stops and sharp transitions

Place two stops at the same percentage position and the blend collapses to zero width. Your browser renders the first color up to that point and starts the second color immediately after with no transition between them. Hard stops produce sharp edges that look like geometric shapes rather than gradients. This is useful for striped patterns, flag effects, and data visualization fills where each segment should be a flat color. Drag a new stop to match an existing stop's position exactly, assign it a different color, and you have a hard stop.4

Repeating gradients and stripes

Stripes and tiling call for the repeating forms of each function. A repeating gradient tiles the stop sequence along the gradient line or around the center instead of stretching one pass edge to edge, and the repetition length is the distance the stops span, so pulling the last stop closer tightens the period.2 Paired with the hard-stop pairs from the previous section, a two-color list becomes crisp stripes: the repeat period sets the stripe width, and the hard stops keep each band flat with no blending between bands. Awnings, progress fills, and hazard bands all reduce to that one combination.

Every copy mode here emits the non-repeating functions, so the repeating form is a hand edit after copying. Replace the function name in the copied output with repeating-linear-gradient() or repeating-conic-gradient() and the stop list carries over unchanged, with the positions you built now setting the tile period. The preview above keeps showing one pass, so expect the page to look plainer than the pasted result: the repetition only happens once the rule lands in a stylesheet. Nothing else in the output changes, which keeps the edit small and reversible, whichever of the three output formats you copied.

Why color space matters in gradients

Gradients between complementary colors often produce a dull, grey midpoint that looks muddy on screen. Blue transitioning to orange passes through a zone where the raw RGB channels mix into a washed-out neutral. This happens because standard sRGB interpolation treats the channels as independent numbers rather than as perceptual relationships between hues, so the blend ignores how the human eye compares colors.

Specifying the interpolation space

CSS Color Level 4 addresses this with the in oklch interpolation syntax. Writing linear-gradient(in oklch, blue, orange) routes the blend through the OKLab color space, which models how the human eye actually perceives color differences, and the midpoint stays vivid rather than going grey.3 The color stop input field on this builder accepts OKLCH values natively: type oklch(0.65 0.2 250) and the stop stores the sRGB hex equivalent of that color, the same hex conversion this page's FAQ describes. The output CSS uses HEX, and the copy panel never emits an interpolation modifier, so in oklch is a hand edit inside the copied function's parentheses. Once present, the blend passes through the perceptual space even between hex stops.

The CSS angle coordinate system

CSS angles start at the top of the element and increase clockwise. At 0deg, the gradient flows from bottom to top. At 90deg, it flows from left to right. At 180deg, it flows from top to bottom. Conversely, the mathematical unit circle starts at the right-hand axis and increases counter-clockwise, which is the opposite convention. This catches developers who expect 0deg to produce a horizontal gradient.

CSS also accepts directional keywords as shorthand: to right (90deg), to bottom (180deg), and to bottom right for a diagonal. The angle dial on this builder outputs numeric degrees; if your codebase uses keyword syntax, substitute the equivalent keyword after copying. For diagonal directions, 135deg is the most commonly used value for design layouts because it produces a natural top-left to bottom-right sweep that reads as a background accent rather than a directional arrow.

What conic gradients are actually useful for

Building a pie chart with CSS requires no SVG and no JavaScript. Conic gradients with hard stops at the right percentages produce flat color segments that function as chart slices. A three-section pie with 40% blue, 35% orange, and 25% green uses three hard-stop pairs: blue from 0% to 40%, orange from 40% to 75%, green from 75% to 100%. The Pie Chart preset in this builder demonstrates this pattern, ready to adapt to your own percentages.5

Sweeping through all hue values produces a full-spectrum color wheel, useful as a picker background or a decorative ring. Furthermore, repeating-conic-gradient, a variant the browser supports natively, tiles the stop pattern repeatedly around the center, creating checkerboard, pinwheel, and starburst patterns from a single gradient rule. Spinner animations are another practical application, and the mechanism matters: a keyframe rule cannot directly animate the gradient's internal from angle, so the pure-CSS version applies the gradient to an element and rotates the whole element with a transform keyframe, producing a loading indicator that runs in CSS with no JavaScript at all.5

Animating a gradient's internals

Plenty of motion around a gradient costs nothing. The element's transform and opacity are animatable properties, so a gradient surface can spin, drift, or breathe while the gradient value itself stays perfectly still. Spinning the element rotates the whole painted surface, pulsing an overlay fades it against its backdrop, and crossfading two gradient layers on hover swaps their opacities. Each of these needs an ordinary keyframe rule and nothing exotic, and each leaves the gradient function untouched. For a conic spinner this is the whole mechanism: the gradient paints the ring once, and the rotation carries the motion.

Values inside the gradient function are a different story. Angles, stop positions, and colors are not animation targets on their own, and the technique that changes that is registering a custom property with @property and building the gradient from that variable, which makes the registered value animatable through an ordinary keyframe rule.6 This builder outputs plain functions, so the registration step is a hand edit after copying: declare the typed custom property, reference it where the changing value sits, and the keyframe can then drive it. A progress bar that sweeps its stop position, for instance, is exactly this pattern.

Why a local tool beats online generators

Online gradient generators vary, but many depend on remote scripts, collect analytics about which presets you use, or stop working the moment the connection drops. For design work involving brand palettes or unpublished product colors, that uncertainty matters because a leaked palette can reveal a rebrand or a product launch before the team is ready to announce it to the public. CapyToolkit runs every gradient calculation in your browser. No request leaves your machine after the page loads, and the tool continues working on an airplane, in a coffee shop with bad Wi-Fi, or on an offline development machine behind a restrictive corporate firewall.

Privacy and offline reliability

When you build gradients locally, the colors you pick never travel over the network. This matters beyond security. It means the tool behaves the same way on a fast office connection and on a spotty train hotspot, with no loading spinners or failed requests interrupting your workflow. The page loads once and then runs entirely on your machine, so there is no dependency on an external service staying online.7

For teams working with unreleased brand colors or client palettes under NDA, keeping that data local removes the risk of it passing through a third-party logging service. There is no account to create, no analytics call reporting which presets you opened, and no clipboard monitor watching what you build. Your gradient data stays on your device for the entire session and is gone when you close the tab, with no server-side record to leak or subpoena. This is why many design systems teams prefer a local inspector over a hosted generator when building palettes that have not yet been made public.

Multiple output formats from one gradient

Output format is the other limitation of most generators. They typically produce a single CSS string in RGBA format, and your gradient still needs to be adapted for Tailwind, converted into design tokens, or split into CSS custom properties before it fits a real project. The output panel here handles all three formats directly: a plain CSS background property for vanilla stylesheets, a Tailwind arbitrary value class ready to paste into JSX, and a custom property block you can drop into a design token file. Switching between formats does not change your underlying gradient. It changes only how that gradient is expressed, so you can copy the right syntax for whichever context you are working in. Keeping all three outputs in sync from a single editor also means you never have to manually reformat the same gradient when moving it between a prototype and a production stylesheet.8

One copied value serves a destination most generators never mention: the text itself. Clipping the background to the glyph shapes fills a heading with your gradient instead of painting behind it. Keep the background: value exactly as this tool copied it, add background-clip: text, and make the text color transparent so the gradient shows through the letterforms.9 Those two hand edits are the whole recipe; every stop, angle, and opacity decision you made carries over untouched. A pair that reads well as a background usually reads well as type, but check the result against small sizes before shipping, because fine letterforms lose gradient detail faster than a wide panel does.

TIP The Vars output format names each stop --g-1, --g-2, and so on by default. Rename them to match your design token naming scheme before pasting the block into a token file. The --gradient variable references those token names, so updating one stop color requires a single variable change that propagates everywhere the gradient is used.8

Sources
  1. 1.

    MDN, "Using CSS gradients," developer.mozilla.org, accessed June 2026. https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Images/Using_gradients

  2. 2.

    W3C, "CSS Images Module Level 4," w3.org, September 2025. https://www.w3.org/TR/css-images-4/

  3. 3.

    Sunkanmi Fafowora, "What You Need to Know About CSS Color Interpolation," css-tricks.com, September 2025. https://css-tricks.com/what-you-need-to-know-about-css-color-interpolation/

  4. 4.

    MDN, "linear-gradient() CSS function," developer.mozilla.org, accessed June 2026. https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/gradient/linear-gradient

  5. 5.

    CSS-Tricks, "Hard Stop Gradients," css-tricks.com, accessed June 2026. https://css-tricks.com/books/greatest-css-tricks/hard-stop-gradients/

  6. 6.

    Sam Thorogood, "@property: giving superpowers to CSS variables," web.dev, accessed September 2026. https://web.dev/articles/at-property

  7. 7.

    Tailwind CSS, "Adding custom styles," tailwindcss.com, accessed June 2026. https://tailwindcss.com/docs/adding-custom-styles

  8. 8.

    web.dev, "Custom properties," web.dev, August 2025. https://web.dev/learn/css/custom-properties

  9. 9.

    W3C, "CSS Backgrounds and Borders Module Level 3," w3.org, March 2024. https://www.w3.org/TR/css-backgrounds-3/

FAQ

Linear gradients transition colors along a straight axis at a set angle — the default for backgrounds and overlays. Radial gradients expand from a focal point outward, which works well for spotlights, vignettes, and circular highlights. Conic gradients rotate color around a center point instead of radiating from it, making them the right choice for pie charts, color wheels, and halo effects. You can switch between all three types without losing your color stop configuration.

Yes. The color stop field accepts HEX, RGB, HSL, HSV, OKLCH, and CSS named colors. Type any valid format and the tool converts it to HEX for storage. This lets you specify stops in perceptually uniform color spaces like OKLCH even when the output CSS uses standard HEX notation.

A hard stop is created by placing two color stops at the same position. Your browser draws the first color up to that point and starts the second color immediately after, with no blending between them. To create this effect, add a stop by clicking the track, drag it to match an existing stop's position number exactly, then assign it a different color. The result is a sharp edge rather than a gradual transition.

Yes. CapyToolkit processes every gradient entirely in your browser. Once the page has loaded, no network connection is needed. Nothing is uploaded, logged, or transmitted — your color choices and CSS output stay on your machine.

The Tailwind option produces an arbitrary value utility class in the format bg-[linear-gradient(...)]. This follows Tailwind's arbitrary value syntax, where spaces inside brackets are written as underscores. Paste it directly into your class attribute so the parser can read the multi-word arbitrary value.

Select a color stop and reduce its Opacity value toward 0. The stop color becomes transparent at that position, creating a fade-to-transparent effect. Combine a fully opaque stop with a 0% opacity stop of the same color to get a clean fade without any color shift.

Additional resources

Guides

CSS Gradient Text with background-clip Apply a CSS gradient to text using background-image and background-clip: text. Browser support, fallback strategy, and live examples with the gradient builder. Animating CSS Gradients with @property Animate CSS gradient stops smoothly using @property custom properties. Browser support, fallback patterns, and OKLCH hue-rotation animations. CSS Mesh Gradient Technique Build mesh-style gradients in CSS using multiple layered radial-gradient() values on the same background-image. No SVG or canvas required. Tailwind CSS v4 Gradient Utilities Complete guide to Tailwind v4 gradient utilities. bg-linear-to-r, bg-radial, bg-conic, from-*, via-*, to-*, and in-oklch modifier reference. CSS Gradient Borders Apply CSS gradient borders using border-image or background-clip masking. Both techniques, browser support comparison, and border-radius workaround. OKLCH Interpolation in CSS Gradients Use OKLCH color space interpolation in CSS gradients with the in oklch modifier. How it eliminates grey midpoints and improves perceptual smoothness. CSS Gradients for Dark Mode UI Design CSS gradients for dark mode using reduced chroma, lower lightness stops, and prefers-color-scheme media queries. Practical patterns for UI surfaces. CSS Background Patterns with Gradients Build repeating CSS background patterns using gradient functions and background-size. Stripes, grids, dots, and diagonal tile techniques without images. Glassmorphism with CSS Gradients Implement the glassmorphism effect with CSS gradients, backdrop-filter blur, and translucent stops. Browser support and performance considerations. CSS Gradient Rendering Across Laptop and Phone Displays How CSS gradients render on the Dell XPS 16, iPhone 17 Pro, MacBook Air M4, MacBook Pro M4 and Galaxy S25: P3 color stops, OKLCH interpolation, OLED blacks and the browser engine each device runs.