Loona Automation โ€บ Image Compressor โ€บ CSS Gradient Generator

CSS Gradient Generator

Build a linear gradient from two or three colours, turn it to any angle with a live preview, and copy the ready-to-paste CSS.

The angle follows the CSS standard: 0deg points up, 90deg points right, 180deg points down. Colour stops are spaced evenly โ€” two colours at 0% and 100%, three at 0%, 50% and 100%.

How to build a CSS gradient in 3 steps

  1. Choose two or three colours โ€” tick the third colour box for a three-stop gradient.
  2. Set the angle โ€” drag the slider and watch the preview turn in real time.
  3. Click the CSS to copy it โ€” paste it straight into your stylesheet or style attribute.

Gradients that look designed, not defaulted

A linear gradient blends one colour into another along a straight line. The classic mistakes are picking colours from opposite ends of the rainbow (the blend turns muddy grey in the middle) and using pure rainbow stops. The reliable recipes: blend two shades of the same hue family for a subtle, professional background; add a third colour when the two-colour blend has a dull middle; and match the angle to the light in your design โ€” 135ยฐ (top-left to bottom-right) suits most screens because it mimics natural light. If you need a starting pair, generate a palette first with the Loona Palette Generator and paste its HEX codes here.

How it works

The generator writes the standard CSS linear-gradient() function for you. Colour stops are spaced evenly: with two colours they sit at 0% and 100%; with three, at 0%, 50% and 100%. The angle uses the CSS convention โ€” 0deg points upward, 90deg to the right, 180deg downward, 270deg to the left โ€” and the browser itself renders the blend, so the preview you see is exactly what the copied code produces. No code leaves your device; the CSS is assembled in your browser.

Worked example

Choose red #ff0000 and blue #0000ff at 90 degrees and the output is background: linear-gradient(90deg, #ff0000 0%, #0000ff 100%); โ€” the blend runs left (0deg would run upward) to right, starting pure red and ending pure blue. Add a middle colour, say gold #d4a017, and it is placed at 50%: linear-gradient(90deg, #ff0000 0%, #d4a017 50%, #0000ff 100%).

Frequently asked questions

Is this gradient generator free?

Yes โ€” free with no signup, and the CSS it produces is yours to use anywhere, including commercial projects.

What is the difference between 0deg and 180deg?

They run the same blend in opposite directions: 0deg starts the first colour at the bottom and blends upward; 180deg starts it at the top and blends downward. Swap the angle by 180 to reverse any gradient.

Can I make a radial gradient?

This tool builds linear gradients, which cover most web design needs. For a radial version, generate the colours here, then change the function name in your CSS to radial-gradient with the same colour stops.

Why does my two-colour blend look grey in the middle?

Colours opposite each other on the wheel cancel out mid-blend. Add a third colour between them (tick Colour 3) that bridges the two hues, and the muddy band disappears.

Will the gradient work in all browsers?

Yes โ€” linear-gradient has been supported by every modern browser for over a decade, with no prefixes needed. The preview uses the same CSS, so what you see is what you get.

More free photo tools

Image Compressor

Compress photos to an exact KB size โ€” 50KB, 100KB, 200KB.

Resize Image

Resize by pixels, cm or inches, with a print DPI setting.

Crop Image

Free crop plus ready ratios โ€” 1:1, 4:3, passport and more.

Image Format Converter

Convert JPG, PNG and WebP both ways, with quality control.

Photo Filters & Fix

Fix brightness, contrast and sharpness in seconds.

Photo Background Changer

Turn a photo background white, blue or light grey.

Photo to PDF

Turn one or more photos into a single PDF file.

Image Watermark

Add a text watermark โ€” set size, colour, opacity, position or tile it.

Color Picker

Pick any colour and copy its HEX, RGB, HSL and HSV values.

Color Palette Generator

Harmonious colour palettes from any base colour, in one click.

Contrast Checker

Check text and background colours against WCAG AA and AAA.

Embed this tool on your website โ€” free

Add this tool to your own website or blog โ€” it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the tool to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.