On this page
"How to convert Figma gradient to CSS gradient" has about 30k views on Figma's forum. The complaint is always the same: the copied CSS looks close but not quite right.
Quick steps
Select the layer
Click the layer with the gradient fill, not the frame around it.
Open the code
Press Shift+D for Dev Mode and find the Code section of the Inspect panel. On a Starter plan or a View seat, right-click and use Copy/Paste as > Copy as code > CSS instead.
Set the language
In the Code section, pick CSS, and px or rem for units.
Copy the snippet
Hover the snippet and click Copy. The gradient is in the background property.
Check it in the browser
Paste it into your stylesheet and compare against the design at the element's real size. Adjust the angle or use corner keywords if a diagonal gradient looks off.
Where does Figma show gradient CSS?
- Dev Mode. The Code section of the Inspect panel. Dev Mode needs a paid plan and a Full or Dev seat. More in how to open Figma Dev Mode.
- Copy as code. Right-click the layer and choose Copy/Paste as > Copy as code > CSS. This works in Design Mode, including for people with view-only access.
- Nothing at all? If the file owner has turned off copying and sharing, the Code section doesn't appear. Ask for access or for the values.
The design panel itself doesn't show an angle. Figma's gradient editor has handles on the canvas, colour stops, and Flip and Rotate buttons, but no degree field. That's why you need the code view to get a number.
Why is the Figma gradient angle different in CSS?
Figma and CSS draw gradients in different ways.
- CSS runs the gradient along a line through the centre of the box at a set angle.
0degpoints up, and angles go clockwise, so90degruns left to right. The line's length depends on the box, so the ends of the gradient always reach the corners. - Figma places the gradient with the handles you drag, then treats it like an image that stretches with the layer. Resize a rectangle and the visible angle changes.
On a square, the two agree. On a wide or tall box, a diagonal gradient in Figma and the same angle in CSS point different ways. The 9elements team wrote up the maths in Gradient angles in CSS, Figma & Sketch. Their conclusion: outside multiples of 90°, you can't reproduce CSS behaviour exactly in Figma.
Why are the stop positions negative or over 100%?
The forum thread's example had stops at -42.51% and 144.22%. That happens when the Figma handles don't sit on the ends of the CSS gradient line. The CSS is still valid. Stops outside 0–100% just mean the colours start and end beyond the edges of the box. If you'd rather have clean numbers, drag the Figma handles to the edges or corners of the layer before you copy.
How to get an accurate linear gradient
- Vertical or horizontal. Keep the handles straight up-and-down or side to side.
180degand90degmatch Figma at any size. - Corner to corner. Drag the handles exactly onto opposite corners, then write the CSS with keywords such as
linear-gradient(to bottom right, …). CSS keywords adapt to the box's shape, which matches how Figma stretches a corner-to-corner gradient. - Any other angle. Copy the snippet, then compare in the browser at the size the element will really be. If the element changes shape at different screen sizes, the gradient will too, in a way Figma doesn't show.
Radial, angular and diamond gradients in CSS
Radial gradients come out as radial-gradient() with the ellipse size and centre as percentages, such as radial-gradient(183.69% 86.67% at 30.59% 81.58%, …). A forum report shows one looking much wider in the browser than in Figma, on a 272 × 56 layer. If yours doesn't match, adjust the two size values by hand. A rotated ellipse is another trap: CSS radial gradients can't rotate the ellipse, so keep radial gradients unrotated in Figma if they're going to code.
CSS has conic-gradient() for angular gradients but nothing for diamond. Figma's help center doesn't document what Dev Mode outputs for these two. Check the snippet, and expect to rebuild a diamond gradient another way, such as an image.
Converting gradients in a plugin or with the API
Neither API gives you an angle. The Plugin API positions a gradient with gradientTransform, a transform matrix, and the REST API returns gradientHandlePositions, three points in the layer's 0–1 space. The forum's accepted approach for plugins is extractLinearGradientParamsFromTransform from the @figma-plugin/helpers package, which turns the matrix back into start and end points. Rotated layers make it harder, and radial gradients are harder still.
If you'd rather not do the maths, code export plugins generate the CSS for you. Compare their gradients with Dev Mode before you trust either.
Ranked listThe best Figma to code plugins in 2026Ranked listBest Figma gradient plugins, including mesh gradientsFor the rest of the handoff, see Figma design specs for developers. Gradients also cause trouble in slides: PowerPoint export turns them into solid colours, as covered in Figma to PowerPoint.
Frequently asked questions
How do I copy a gradient as CSS in Figma?
Select the layer and copy from the Code section in Dev Mode, or right-click and choose Copy/Paste as > Copy as code > CSS.
Why does my gradient look different in the browser?
Figma stretches gradients with the layer, while CSS recalculates the gradient line for the box. Diagonal gradients on non-square elements drift the most.
Can I see the gradient angle in Figma without Dev Mode?
Figma's gradient editor has no angle field. Use Copy as code to get the CSS, which includes the angle in degrees.
Does Figma export angular gradients to CSS?
CSS has conic-gradient() for angular gradients. Figma's help center doesn't document the exact output, so check the snippet in a browser.
More in Dev Mode & handoff
- Figma Annotations: How They Work and Who Can See ThemHow Figma annotations work in Design and Dev Mode, which seats can add and view them, how they differ from comments, and when an annotation plugin helps.
- How to Make Design Specs in FigmaWhat a Figma design spec should include, how to build a component spec template by hand, what Dev Mode already covers, and how to generate specs with Autospec.
- How to Open Figma in Dev ModeOpen Figma Dev Mode with Shift+D or the toolbar toggle. Which plans and seats get it, why you see "can't access Dev Mode", and how to inspect without it.
- Where Is the Inspect Tab in Figma?Figma's Inspect tab now lives in Dev Mode. How to see CSS and specs without a Dev seat, get a missing right sidebar back, and find what else UI3 moved.
- How to Set Up the Figma MCP ServerSet up the Figma MCP server in Claude Code, Cursor, VS Code or Codex, see tool call limits for your plan and seat, and fix OAuth, connection and tool errors.
- How to install Figma pluginsFigma plugins don't need installing: open one from the Community or run it inside a file. Steps for Figma Design, Dev Mode, FigJam, Slides, saving and admins.
- Figma plugins not working? How to fix itFigma plugins not loading, missing or greyed out? Check your seat and edit access, org approval, network blocks and cache. A step-by-step checklist that works.
- How to Generate All Component Variants in FigmaFigma shows only the variants you draw. Here's how to lay out every combination of variant, boolean and nested props as a matrix, by hand or with Instancer.
