CSS Gradient Generator - Linear, Radial and Conic

Tools / Dev Tools / CSS Gradient Generator

CSS gradient generator

Presets
135°

0° points up, 90° to the right, 180° down - clockwise, unlike the angles in maths class.

Colour stops
CSS
background: #a856d6;
background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);

The first line is a solid fallback, the average of your colours. It shows wherever the gradient line is ignored.

Making CSS gradients that look right

A CSS gradient is an image the browser draws for you: no file to download, sharp at any size and easy to change. This generator writes the background property for linear (a straight band of colour), radial (spreading out from a point) and conic (sweeping around a point, like a colour wheel or pie chart) gradients, and shows the result as you edit.

How to use it

  1. 1 Pick a preset or choose linear, radial or conic, then set the angle, the shape or the centre.
  2. 2 Edit the colour stops: click the swatch or type a hex code, set where each colour sits (0-100%) and how opaque it is. Add stops for more colours.
  3. 3 Copy the two CSS lines and paste them into the rule for your element, for example a hero section or a button.

Which way does the angle point?

In CSS the angle is the direction the gradient travels towards: 0deg goes up, 90deg goes right and 180deg, the default, goes down. It turns clockwise, the opposite of the maths convention, so designs copied from a graphics program often come out mirrored. The keyword to top right is not the same as 45deg either: the keyword aims at the corner of the box, so on a wide banner it is much flatter than 45 degrees.

Hard lines, stripes and stop order

Colours blend between stops. Put two stops at the same position and there is no room to blend, so you get a crisp line: blue 0%, blue 50%, red 50%, red 100% gives a half-and-half split, as in the stripes preset. A stop whose position is smaller than the one before it is pulled forward to that earlier position, which also makes a hard edge, usually by accident. That is why this tool always writes the stops in position order, and the sort button puts the rows in the same order on screen.

Fading to transparent

For a shadow or a dark band behind text on a photo, fade a colour to the same colour at 0% opacity, as the last preset does, rather than to the keyword transparent. transparent means transparent black, and older browsers blended through it, leaving a greyish haze in the middle. Current browsers handle it correctly, but the same-colour stop is safe everywhere and makes the intent obvious. The chequered pattern behind the preview shows exactly how see-through each part is.

Radial, conic and the fallback line

A radial circle stays round on any box, while an ellipse stretches to the box’s proportions, which suits wide headers. Conic gradients sweep around the centre and are handy for colour wheels, pie charts and loading rings; start and end with the same colour for a seamless loop. The extra background line with a single colour is not decoration: if the gradient line has a typo, the browser drops that whole line and uses the one before it, and email clients that ignore gradients show it too.

CSS gradient generator - frequently asked questions

Set the background (or background-image) property to a gradient function, for example background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%). Build it here, press Copy CSS and paste both lines into your rule. The element needs a size, because a gradient fills the box it is given: an empty div with no height shows nothing.
New
Subnet Calculator Enter an IPv4 address with a CIDR prefix or netmask to get the network and broadcast address, usable host range, host count, wildcard and binary view.
Popular Today
MD5 Hash Generator Free MD5 hash generator: turn any text or file into an MD5 checksum in your browser - useful for integrity checks and quick fingerprinting.

Related Dev Tools

MD5 Hash Generator Free MD5 hash generator: turn any text or file into an MD5 checksum in your browser - useful for integrity checks and quick fingerprinting.
Base64 Encoder & Decoder Free Base64 encoder and decoder: convert text or files to Base64 and back, entirely in your browser - nothing is uploaded to a server.
JWT Decoder Free JWT decoder: paste a token to read its header, payload and signature in a readable form - decoding happens in your browser, nothing is sent.
URL Encoder & Decoder Free URL encoder and decoder: convert links and query parameters to percent-encoding and back, with full-URL and component modes, in your browser.
UUID Generator Free UUID generator: create v1, v4 and v5 identifiers instantly, generate them in bulk and copy any value with a single click - no signup needed.

Other Tools You May Like

Word to PDF Convert Word to PDF for free: upload a DOC, DOCX, ODT or RTF file and download a properly formatted PDF in seconds - no registration or watermark.
PDF to Word Convert PDF to Word for free: upload a PDF and download an editable DOCX in seconds - no registration, no watermark and nothing to install.
Word Counter Free word counter: paste any text to count words, characters, sentences and paragraphs, and see the estimated reading time - nothing leaves your browser.
Character Counter Free character counter: count characters with and without spaces, plus words and lines, and check SEO limits for titles and meta descriptions.
Keyword Density Checker Free keyword density checker: paste text or a URL to see how often each word and phrase appears, with percentages for one, two and three-word terms.