Skip to content
MyToolkit.pro

Code & Data

CSS Gradient Generator

Build a linear or radial gradient visually, position every colour stop, and copy or download ready-to-paste CSS. Everything stays in this browser.

Private by design: no text is uploaded or stored.

Visual gradient editor

Drag the handles or edit their exact colour and position below.

Keyboard: focus a handle and use arrow keys (Shift = 10%); Delete removes it when more than two stops remain.

Paste 2–8 comma-separated HEX colours, then apply them to the editor.

Try an example

Gradient

Updates live when you change a stop, direction, or centre.

Preview

Colour stops
—
Download CSS

How do CSS gradients work?

A colour stop combines a colour with a position from 0% to 100%. Linear gradients follow an angle (0deg points up and 90deg right); radial gradients spread from the selected centre. Dragging and arrow keys change the same positions. The declaration is assembled and previewed entirely in your browser.

How to build a gradient and copy the CSS

  1. Choose Type: Linear for a gradient that runs along a direction, Radial for one that spreads out from a point.
  2. Set your colours. You can paste a list such as #2193b0, #6dd5ed into Quick colour list and press Apply colours. You can also edit each stop in the rows under the track, where every row has a colour picker, a HEX text field and a position from 0 to 100.
  3. Drag the round handles on the track to move stops. Each Add colour stop click inserts a new stop halfway between the last two stops, up to eight in total. The × button removes a stop, but there are always at least two.
  4. For a linear gradient, set the angle with the slider or the number field next to it (0–360). For a radial gradient, pick Shape (Circle or Ellipse) and move the horizontal and vertical centre sliders. The preview shows the centre with a small marker.
  5. Press Copy CSS to put the declaration on your clipboard. Download CSS saves the same text as gradient.css.

When you apply a pasted list, the stops are spread out evenly: two colours land at 0% and 100%, three at 0%, 50% and 100%, and four at 0%, 33%, 67% and 100%. After that you can move each one by hand.

What the generated CSS looks like

Every result is two background lines. The first is a solid fallback that uses the first stop's colour, for browsers that can't read the second line. The second is the gradient, with every stop's position written out. Colours are converted to lowercase.

The Ocean example (two colours, 135°):

background: #2193b0;
background: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%);

Four short HEX colours at 180°, which runs from top to bottom:

background: #f00;
background: linear-gradient(180deg, #f00 0%, #0f0 33%, #00f 67%, #000 100%);

An elliptical radial gradient with its centre moved to the lower left (horizontal 20%, vertical 80%):

background: #ffffff;
background: radial-gradient(ellipse at 20% 80%, #ffffff 0%, #7028e4 100%);

If you leave the centre at 50% / 50%, the output still includes at 50% 50%. That is the same as the CSS default, so you can delete it if you want shorter code.

Where these gradients are useful

  • Hero sections and banners: build a two- or three-colour linear gradient and paste the declaration into the section's rule.
  • Image overlays for readable text: use 8-digit HEX values with an alpha channel, for example #000000cc at 0% and #00000000 at 100% at 0deg. This gives a scrim that is dark at the bottom and fades out towards the top, which you can layer over a photo.
  • Spotlight or glow backgrounds: choose Radial, move the centre towards one corner and use a light colour fading into your brand colour.
  • Matching a design file: type the exact HEX values and stop positions from a mockup into the stop rows instead of judging them by eye on the track.

If you only have a colour in RGB or HSL, convert it first with the Color Converter. If you have no colours chosen yet, the Color Palette Generator can suggest a harmonious set to use as stops.

Limits and edge cases

  • Colours must be HEX in 3-, 6- or 8-digit form, each with a leading #. Names like red, rgb(), hsl() and 4-digit HEX are not accepted. In the quick colour list, an invalid entry shows an error message and no CSS is generated. In a stop's HEX field, an invalid value is ignored and the previous colour comes back.
  • You need 2–8 stops. With fewer than two or more than eight, the quick list shows the error and doesn't change the editor.
  • Stop positions are whole percentages from 0 to 100. Dragging and arrow keys snap to whole numbers. The tool doesn't produce pixel positions, hard colour bands written with two positions per stop, or colour hints between stops. Add those by hand after copying.
  • Stops are re-sorted by position after every change, so dragging one past another swaps their order in the CSS.
  • Only linear-gradient and radial-gradient are generated. Repeating gradients, conic-gradient, radial size keywords such as closest-side, and stacked multiple backgrounds are not available.
  • The angle must be between 0 and 360. A value outside that range removes the output until you correct it.

The full syntax, including the parts this editor doesn't write, is described in MDN's linear-gradient() reference. For a walkthrough of angles, stop placement and fallbacks, see How to Build a CSS Gradient: Angles, Stops and Fallbacks.

Frequently asked questions

Which direction is 90deg in a CSS linear gradient?

In CSS, 0deg points up (bottom to top), 90deg points right (left to right), 180deg points down and 270deg points left. The `to right` keyword gives the same result as 90deg.

Do I still need the -webkit- prefix for CSS gradients?

No. Current versions of Chrome, Edge, Firefox and Safari support unprefixed `linear-gradient()` and `radial-gradient()`.

How do I make a transparent CSS gradient?

Use 8-digit HEX colours, where the last two digits set opacity (`00` is fully transparent, `ff` is opaque), for example `#000000cc` at 0% to `#00000000` at 100%. The fallback line uses the first stop's colour together with its transparency, so here it is the semi-transparent `#000000cc`.

Can I put a gradient on text instead of a background?

Yes. Paste the gradient value into `background-image` on the text element, then add `background-clip: text` (plus `-webkit-background-clip: text` for older Safari and WebKit browsers) and `color: transparent`. The generated `linear-gradient(...)` works there without any changes.

What is the difference between circle and ellipse in a radial gradient?

A circle keeps the same radius in every direction. An ellipse stretches to match the element's proportions, so on a wide banner it looks wider than it is tall.

All in Code & Data

Color Palette Generator

Generate a harmonious colour palette from one hex colour — complementary, analogous, triadic, tetradic or monochrome. Runs in your browser, nothing uploaded.

Code & Data In your browser

Password Generator

Generate strong, random passwords in your browser. Choose the length and character sets, avoid ambiguous characters, and see the entropy in bits. Nothing is uploaded.

Code & Data In your browser

QR Code Generator

Generate a QR code from text or a URL, entirely in your browser. No upload, no external library, no tracking. Download as PNG.

Code & Data In your browser

UUID Generator

Generate random UUID version 4 identifiers instantly in your browser.

Code & Data In your browser

Color Converter

Paste any color — HEX, RGB, HSL or a CSS name — and get every format at once, with a live swatch, RGB sliders, WCAG contrast and lighter/darker variants. Nothing is uploaded.

Code & Data In your browser

Hash Generator

Generate MD5, SHA-1, SHA-256 and SHA-512 hashes of any text in your browser. Digests update instantly and nothing is uploaded.

Code & Data In your browser

What do you need?

Swipe up for the next one