Skip to main content

    CSS Gradient Generator

    Generate beautiful CSS gradients visually. Pick colours, adjust angle, and copy the CSS code.

    No signup. 100% private. Processed in your browser.

    CSS Code

    background: linear-gradient(135deg, #6366f1, #ec4899);

    CSS Gradients: A Complete Guide

    Gradients are one of the most underused tools in a developer's CSS toolkit. They create smooth colour transitions without images, meaning zero extra HTTP requests, infinite scalability, and tiny file sizes. A gradient that would be a 50KB PNG is just one line of CSS.

    CSS supports three types: linear (straight lines), radial (circular/elliptical), and conic (angular, like a pie chart). Linear gradients cover 90% of real-world use cases — hero backgrounds, buttons, overlays, and decorative elements.

    This generator gives you a visual preview with adjustable colours, angles, and stops. Copy the CSS and paste it directly into your stylesheet. Browser support is universal — gradients work in every modern browser without prefixes.

    Gradient Types Compared

    TypeSyntaxBest For
    Linearlinear-gradient(to right, #000, #fff)Backgrounds, buttons, overlays, hero sections
    Radialradial-gradient(circle, #000, #fff)Spotlights, glows, vignette effects
    Conicconic-gradient(from 0deg, #000, #fff)Pie charts, colour wheels, progress rings
    Repeating linearrepeating-linear-gradient(45deg, ...)Stripes, diagonal patterns, progress bars

    Gradient Tips for Developers

    Avoid the grey zone

    Gradients between complementary colours (e.g., blue→orange) pass through muddy grey. Add a mid-point colour to keep the transition vibrant. Blue→purple→orange looks far better than blue→orange.

    Use gradients for text overlays

    A subtle gradient from transparent to rgba(0,0,0,0.7) makes white text readable over any image. Much more elegant than a solid dark overlay.

    Layer multiple gradients

    CSS supports stacking gradients with commas. Combine a radial spotlight with a linear tint for depth: background: radial-gradient(...), linear-gradient(...).

    Performance is excellent

    CSS gradients are rendered by the GPU with near-zero performance cost. They're faster than images and scale perfectly to any resolution, including Retina displays.

    Popular Gradient Presets

    Starting from scratch is hard. These proven combinations work well for common UI elements:

    NameCSSUse Case
    Sunsetlinear-gradient(135deg, #f093fb, #f5576c)Hero backgrounds, CTAs
    Oceanlinear-gradient(135deg, #667eea, #764ba2)SaaS landing pages, cards
    Mintlinear-gradient(135deg, #11998e, #38ef7d)Success states, eco themes
    Midnightlinear-gradient(135deg, #0c0c1d, #1a1a3e)Dark mode backgrounds
    Glasslinear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0))Glassmorphism overlays
    Text fadelinear-gradient(to bottom, transparent, var(--bg))"Read more" content cutoff

    135deg is the most popular gradient angle in modern design — it goes from top-left to bottom-right, which feels natural because we read in that direction.

    Related Tools

    How to use this tool

    1

    Choose linear or radial gradient type

    2

    Pick two colours using the colour pickers or enter hex codes

    3

    Adjust the angle with the slider (linear) and copy the CSS

    Common uses

    • Creating hero section backgrounds
    • Styling buttons and cards with colour transitions
    • Adding overlay effects on images
    • Designing decorative UI elements
    • Building colour-based loading indicators

    Share this tool

    Frequently Asked Questions