Radial and Conic Gradients, and Choosing the Interpolation Color Space
radial-gradient() shapes, sizes and positions, conic-gradient() angles and pie charts, the repeating forms, patterns built from them, and choosing how any gradient blends: the in keyword, color spaces such as oklab and oklch, and hue directions.
kvi5hnuCode Sprout team member8 min readOn this page
Linear gradients change color along a line (article 50). Two other gradient functions change color in other ways: radial gradients spread out from a center point in circles or ellipses, and conic gradients sweep around a center point, like the hands of a clock. They share the same color stops, hard stops and hints, and the same choice of color space for blending, which this article covers at the end.
Radial gradients
.spot { background: radial-gradient(#f4c95d, #8a3b12); }
With no other arguments, a radial gradient is an ellipse centered in the box, sized so its edge, where the last color stop sits, reaches the box's corners. The full syntax puts a shape, size and position before the stops:
radial-gradient(circle closest-side at 30% 40%, #f4c95d, #8a3b12)
/* shape size position */
Shape and size
| Size | The gradient's edge reaches... |
|---|---|
farthest-corner (default) | the corner farthest from the center |
closest-corner | the nearest corner |
farthest-side | the farthest side (for an ellipse, the farthest side in each axis) |
closest-side | the nearest side (for an ellipse, in each axis) |
a length, such as 5rem | a circle with that radius |
two lengths or percentages, such as 60% 40% | an ellipse with those horizontal and vertical radii |
The shape is circle or ellipse (the default). One length means a circle; two values mean an ellipse. A circle can't take a percentage, since a percentage of which axis would be unclear: radial-gradient(circle 50%, ...) is invalid, and the whole declaration is dropped.

The size keyword only decides where 100% falls; the stops are then spread along that distance, so the same colors look tighter with closest-side than with the default.
Position
at followed by a position, using the same syntax as background-position (article 48): at top left, at 30% 40%, at right 1rem bottom 1rem. The default is at center.
Stops along the ray
Radial stop positions are measured along the gradient ray, from the center (0%) out to the edge set by the size (100%). After the last stop, the last color fills the rest of the box. Hard stops make solid circles and rings:
radial-gradient(circle, #2f7d4f 0 30%, transparent 31%) /* a solid dot, slightly soft at the edge */
The 1% gap between 30% and 31% gives a slightly soft edge. An exact hard stop can look jagged on curves.
Conic gradients
A conic gradient changes color by angle around a center point, starting from the top and going clockwise:
conic-gradient(from 0deg at 50% 50%, #8a3b12, #f4c95d, #8a3b12)
/* start angle center */
from <angle>rotates the starting point, which is at the top (0deg) by default.at <position>moves the center.- Stop positions are angles (
90deg,0.25turn) or percentages of the full turn.conic-gradient(red 0.25turn, blue 50%)is valid.
Conic gradients draw pie charts, color wheels, angled "spotlight" sweeps and checkerboards. A pie chart is just hard stops:
.pie {
aspect-ratio: 1;
border-radius: 50%;
background: conic-gradient(#8a3b12 0 40%, #f4c95d 40% 70%, #2f7d4f 70% 100%);
}
A chart drawn in CSS is invisible to screen readers, so give it a text equivalent: a caption with the numbers, or role="img" with an aria-label.

All six are single background declarations, with no images.
Repeating forms
repeating-radial-gradient() and repeating-conic-gradient() repeat their stops, like repeating-linear-gradient(). Give the last stop a length (radial) or angle (conic) to set the pattern's size:
repeating-radial-gradient(circle, #f4efe6 0 6px, #e8dcc8 6px 12px) /* rings 12px apart */
repeating-conic-gradient(#f4efe6 0 15deg, #e8dcc8 15deg 30deg) /* 12 rays */
body { font: 0.72rem system-ui, sans-serif; margin: 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.5rem; }
.g { block-size: 5rem; border-radius: 6px; display: grid; place-items: end start; padding: 0.25rem; font-weight: 700; }
.g span { background: rgb(255 255 255 / 0.85); padding: 0 0.25rem; border-radius: 3px; }
.a { background: radial-gradient(#f4c95d, #8a3b12); }
.b { background: radial-gradient(circle closest-side at 30% 40%, #f4c95d, #8a3b12); }
.c { background: radial-gradient(circle, #2f7d4f 0 30%, transparent 33%) 0 0 / 1rem 1rem, #f4efe6; }
.d { background: conic-gradient(from 0deg, #8a3b12, #f4c95d, #2f7d4f, #8a3b12); }
.e { background: conic-gradient(#8a3b12 0 40%, #f4c95d 40% 70%, #2f7d4f 70%); }
.f { background: repeating-conic-gradient(#2b2118 0 25%, #f4efe6 0 50%) 0 0 / 1.25rem 1.25rem; }
.h { background: repeating-radial-gradient(circle, #f4efe6 0 6px, #e8dcc8 6px 12px); }
.i { background: repeating-conic-gradient(#f4efe6 0 15deg, #f4c95d 15deg 30deg); }
The checkerboard uses a trick from article 50: a stop positioned before the previous one (0) is moved up to it, so #f4efe6 0 50% starts exactly where the dark quarter ends. The pie chart tile is the conic gradient on its own; on a square element with border-radius: 50%, it becomes a round chart.
Choosing the interpolation color space
All gradient functions, and color-mix() (article 33), accept an in <color space> clause that sets how the colors between two stops are calculated:
linear-gradient(to right in oklab, #f4c95d, #2f7d4f)
radial-gradient(circle in oklch, #8a3b12, #2f7d4f)
conic-gradient(in hsl longer hue, red, red) /* a full color wheel */
For linear-gradient(), the clause can come after the direction or replace it: linear-gradient(in oklab, ...). For the others, it goes with the shape, size and position.
Without the clause, gradients between legacy sRGB colors (hex, rgb(), hsl(), names) blend in sRGB, and gradients with any newer color syntax blend in Oklab.
| Space | What blending in it looks like | Good for |
|---|---|---|
srgb | the old default; mid-points between saturated colors can look dark and dull | matching older designs |
srgb-linear | physically even light mixing; often looks too bright in the middle | light and glow effects |
oklab | perceptually even; smooth, no muddy middle | most gradients |
lab | perceptual like oklab, slightly less even | matching designs made in Lab |
xyz | the same as srgb-linear | light effects |
display-p3, rec2020 | like srgb, but in a wider gamut | wide-gamut colors |
oklch, lch, hsl, hwb | polar: interpolate the hue around the color wheel, keeping colors saturated | vivid gradients, rainbows |

Compare the first and third rows for the usual choice between the old default and oklab, and the polar rows to see how far the hue can travel.
Hue interpolation
Polar spaces go around the hue wheel, and there are two ways around. A hue interpolation method after the space picks the way:
| Method | Goes |
|---|---|
shorter hue (default) | the short way round, under 180° |
longer hue | the long way round, through more colors |
increasing hue, decreasing hue | the hue angle always increases, or always decreases |
So in oklch longer hue from red to red is a full rainbow, and conic-gradient(in hsl longer hue, red, red) draws a complete color wheel.
body { font: 0.8rem system-ui, sans-serif; margin: 1rem; }
.row { display: grid; grid-template-columns: 6.5rem 1fr; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.bar {
block-size: 2rem;
border-radius: 6px;
background: linear-gradient(to right var(--space), #2f6fd8, #f4c95d); /* blue to yellow */
}
Blue and yellow are near opposites on the color wheel, so any straight blend between them, in sRGB or Oklab, passes through gray; Oklab's gray is lighter and more even in brightness. The polar OkLCh keeps the colors saturated by turning the hue instead: through green the short way, or through pink and orange the long way. As a rule, in oklab fixes dark, uneven middles between similar colors, and in oklch keeps saturated colors vivid, at the cost of passing through other hues.
What's current
- Radial and conic gradients and their repeating forms work in every browser; conic gradients have since 2020.
- The
in <color space>syntax and hue methods are Baseline since 2024 (Chrome 111, Safari 16.2, Firefox 127). - Gradients with modern color syntaxes blend in Oklab by default; legacy ones still blend in sRGB.
Common questions
How do I make a circle that doesn't stretch into an ellipse?
Add circle: radial-gradient(circle, ...). With an explicit size, use one length, such as radial-gradient(5rem, ...).
Why is my radial-gradient(circle 50%, ...) ignored?
Circles can't have percentage sizes. Use a length, a size keyword such as closest-side, or an ellipse with two percentages.
How do I make a pie chart?
conic-gradient() with hard stops, on a square element with border-radius: 50%, plus a text alternative for screen readers.
Why is the middle of my gradient muddy?
The colors are blending in sRGB, which darkens mid-tones; in oklab gives a more even blend. If the two colors are near opposites, any straight blend passes through gray, and in oklch keeps it saturated by rotating the hue.
What does longer hue do?
In a polar color space, it interpolates the hue the long way around the wheel, passing through more colors.
Summary
radial-gradient(shape size at position, stops):circleorellipse, sized byclosest-side,farthest-corner(default) and the rest, or lengths; circles can't use percentages.conic-gradient(from angle at position, stops)sweeps clockwise from the top; stops are angles or percentages of a turn.- Repeating forms repeat the stops; the last stop sets the pattern size.
in <space>sets the blend's color space:oklabfor even blends,oklchto stay saturated, withshorter,longer,increasingordecreasing hue.- Legacy colors blend in sRGB by default, modern colors in Oklab.
Practice questions
Write a radial gradient: a circle centered in the top-right corner, #f4c95d in the middle, fading to transparent 10rem from the corner. Why wouldn't closest-side work here?
Answer
background: radial-gradient(circle 10rem at top right, #f4c95d, transparent);
With the center in a corner, the two nearest sides pass through the center, so closest-side would give the gradient zero size.
Draw a pie chart that's 25% green (#2f7d4f) and 75% cream (#f4efe6), starting at the top.
Answer
.pie {
aspect-ratio: 1;
border-radius: 50%;
background: conic-gradient(#2f7d4f 0 25%, #f4efe6 25%);
}
Is this valid? If not, fix it.
.glow { background: radial-gradient(circle 40%, white, transparent); }
Answer
No: a circle can't have a percentage size. Use a length (circle 8rem), a keyword (circle closest-side), or an ellipse (40% 40%).
Write a full color wheel with a conic gradient.
Answer
.wheel { aspect-ratio: 1; border-radius: 50%; background: conic-gradient(in oklch longer hue, red, red); }
Previous: Linear Gradients: Directions, Color Stops, Hints and Repeating Gradients

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.