Home › Image Tools › CSS Gradient Generator

CSS Gradient Generator

Build a gradient background visually: drag color stops, pick linear, radial or conic, set the angle and copy ready-to-use CSS. Need an image instead? Download the same gradient as a PNG in any size.

Last updated:

Color stops (click the bar to add, drag to move)
Presets
PNG image
Advertisement
Advertisement

How to use the CSS Gradient Generator

  1. Choose a type: Linear, Radial or Conic.
  2. Edit the color stops: click the bar to add a stop, drag the handles to move them, and change color, position or opacity in the list below.
  3. Set the direction with the angle slider or arrow buttons, or the center, shape and size for radial and conic gradients.
  4. Press Copy CSS and paste the code into your stylesheet.
  5. Need an image? Pick a size and press Download PNG.

CSS gradient syntax cheat sheet

TypeExampleResult
Linearlinear-gradient(90deg, #ff7e5f 0%, #feb47b 100%)Coral on the left fading to peach on the right
Linear, 3 stopslinear-gradient(180deg, #a1c4fd, #c2e9fb 60%, #fff)Sky blue at the top to white at the bottom
Radialradial-gradient(circle at 50% 50%, #fff 0%, #c7782f 100%)White center glowing out to amber
Radial ellipseradial-gradient(ellipse closest-side at 30% 40%, …)Ellipse that touches the nearest edges
Conicconic-gradient(from 0deg at 50% 50%, red, yellow, lime, aqua, blue, magenta, red)A full hue wheel
Stripesrepeating-linear-gradient(45deg, #2f6b4f 0% 5%, #fff 5% 10%)Diagonal stripes

How the gradient line is calculated

For a linear gradient at angle θ in a box of width W and height H, CSS makes the gradient line pass through the center and sets its length to L = |W · sin θ| + |H · cos θ|, so the 0% and 100% positions land exactly in the corners. Example: a 1920 × 1080 image at 45° has L = 1920 × 0.707 + 1080 × 0.707 ≈ 2121 px, so a stop at 50% sits in the exact center and a stop at 25% is 530 px from the start of the line.

For a radial gradient the default size is farthest-corner: a circle centered at 50% 50% of a 1920 × 1080 box has a radius of √(960² + 540²) ≈ 1101 px. The PNG export reproduces these rules, including ellipses and the closest-side, farthest-side and closest-corner sizes.

Design tips

  • Use neighbors on the color wheel (for example blue to purple) for smooth gradients; complementary pairs such as red to green pass through a muddy middle.
  • Add a middle stop slightly brighter than both ends to avoid a dull gray band.
  • Keep text readable: check the contrast of your text against the lightest and darkest parts of the gradient.
  • Subtle is often better for UI backgrounds: try two very close tints like #e0eafc → #cfdef3.
  • Export a PNG for places where CSS is not available, such as email signatures, slides or social media banners.

Frequently asked questions

How do I use the generated CSS?

Paste both lines into the CSS rule of the element, for example body { … } or .hero { … }. The first line sets a solid fallback color for very old browsers; the second line sets the gradient. Gradients are images in CSS, so you can also use them with background-image.

What does the angle mean in a linear gradient?

0deg points up, 90deg points right, 180deg down and 270deg left, so linear-gradient(90deg, red, blue) runs from red on the left to blue on the right. The gradient line is long enough to cover the corners at any angle.

What is a conic gradient?

A conic gradient sweeps colors around a center point, like a color wheel or pie chart. The from angle sets where the first color starts, measured clockwise from the top. All modern browsers support conic-gradient().

How do I make a hard line between two colors?

Give two neighboring stops the same position, for example #ff0000 50% and #0000ff 50%. Combined with Repeating gradient this creates stripes.

Is the PNG exactly the same as the CSS gradient?

The PNG is drawn with the canvas API using the same angle, gradient line length, center, shape and size rules as CSS, so it matches the preview. Tiny differences in color blending between browsers are possible.

Can I add transparency?

Yes. Lower the α (opacity) slider of a stop to fade it out. The CSS then uses rgba() colors, and the PNG keeps the transparency.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Color Palette GeneratorGenerate beautiful color palettes and export them.Wallpaper GeneratorCreate gradient and pattern wallpapers sized for any phone, tablet or desktopColor Shades GeneratorTurn one HEX color into a 50-950 scale plus tints, shades and tones, ready to export.HEX to RGBConvert HEX colors to RGB and other formats.Add Background to Transparent PNGFill the transparent areas of a PNG with a color, gradient or photo, plus padding and shadow.BlurHash GeneratorEncode an image to a BlurHash or ThumbHash placeholder, preview it and copy ready-made code.Color Code ConverterConvert a color between HEX, RGB, HSL, HSV, CMYK, LAB, LCH and OKLCH with a live swatch.Color Palette from ImageExtract the main colors of any photo as HEX codes, CSS variables and a palette PNG.Meme GeneratorMake memes with classic templates and custom text.Logo MakerDesign a text logo with fonts, icons and colors, then save SVG or PNG.Certificate MakerDesign certificates from templates and export one or many as PDF.GIF MakerTurn videos and images into GIFs, trim and compress.Business Card MakerDesign business cards and download a print-ready PDF.Flyer MakerDesign printable and social media flyers from free templates.Poster MakerDesign posters in A0–A5 and US sizes and download a print-ready PDF.Invitation Card MakerCreate printable birthday, wedding and party invitations for free.Thumbnail Safe ZonePreview YouTube and TikTok thumbnail safe zones.Thumbnail MakerDesign 1280×720 YouTube thumbnails with templates, bold text and stickersYouTube Thumbnail GrabberPaste a YouTube link to get every thumbnail size, from HD 1280x720 down to 120x90.Chart MakerMake bar, line, area, pie and doughnut charts from a simple table and download PNG or SVG.Venn Diagram MakerMake 2- or 3-circle Venn diagrams from lists; overlaps are found for you. Export PNG or SVG.Mind Map MakerBuild mind maps fast with keyboard shortcuts and auto layout, then export PNG, SVG or JSON.Org Chart MakerType an indented list of names and titles and get a clean org chart to download as PNG or SVG.Timeline MakerCreate horizontal or vertical timelines from dated events with colors, then save PNG or SVG.Gantt Chart MakerPlan tasks with dates, progress and dependencies on a Gantt chart, then export PNG or CSV.Word Cloud GeneratorTurn any text into a word cloud in shapes like a heart or star, then save it as PNG or SVG.Pie Chart MakerMake pie and donut charts with labels, percentages and a legend, then download PNG or SVG.Favicon GeneratorMake a favicon.ico, PNG icons, apple-touch-icon and web manifest from an image, text or emoji.Passport Photo MakerMake passport and visa photos for any country and print them on a 4x6 sheet.Signature MakerDraw or type your signature and download it as a transparent PNG or SVG.Quote Image MakerTurn a quote into a shareable image for Instagram, Stories or X with backgrounds and fonts.Profile Picture MakerMake a round or square profile picture with a ring border and color or gradient background.Before and After Image MakerCombine two photos into a labeled before and after image or an animated slider video.Device Mockup GeneratorPut a screenshot into a phone, tablet, laptop, monitor or browser frame and download a PNG.Seamless Pattern GeneratorMake seamless dot, stripe, wave, grid, zigzag and check patterns. Export CSS, SVG or PNG.3D Text GeneratorRender extruded 3D text with depth, bevel, materials and rotation; export a transparent PNG.Album Cover MakerDesign 3000×3000 album and podcast cover art with photo filters and type presets.Animated Text GIF MakerCreate animated text GIFs with typing, blink, bounce, rainbow or scroll effects; GIF or WebM.Speech Bubble GeneratorAdd comic speech, thought and shout bubbles to photos; drag, resize, aim the tail, save PNG.Star Map GeneratorCreate a custom star map poster of the night sky for any date and place, with your own text.Trading Card MakerDesign custom collectible cards with photo, stats and rarity frames; print a 9-card PDF sheet.Vision Board MakerMake a vision board with your photos, goals and affirmations, sized as a phone or desktop wallpaper.WordArt GeneratorRetro WordArt text with arcs, waves, gradients and 3D depth. Download a transparent PNG.Anaglyph 3D Image MakerTurn a left/right photo pair into a red-cyan 3D anaglyph or cross-eye stereo pair.Bead Loom Pattern MakerDesign loom, peyote and brick stitch bead patterns with counts, word chart and image import.Birth Announcement MakerAdd your baby's photo, name, birth date, time, weight and length to a card you can share or print.Business Model Canvas MakerFill the 9 Business Model Canvas blocks with color sticky notes and download a PNG or PDF.Cat Breed IdentifierUpload a cat photo to get likely breeds, coat pattern and colors, using AI that runs on your device.Chalkboard Sign MakerDesign chalkboard-style menu and event signs with hand-lettered fonts and doodles; PNG or PDF.Deck DesignerDesign a deck to scale with joists, beams, posts, stairs and board layout; PNG and list.DICOM ViewerOpen DICOM .dcm medical images in your browser, adjust window/level, read tags and export PNG.Lean Canvas GeneratorFill in the 9 Lean Canvas boxes and get a clean one-page canvas as PNG, JPG or PDF.Loyalty Punch Card MakerDesign business-card-size stamp cards with your logo and reward, then print a sheet as PDF.Normal Map GeneratorTurn a texture photo into normal, height, roughness and AO maps with a live 3D preview.Pregnancy Announcement MakerMake a pregnancy announcement image with a letter board, ultrasound photo and due date.Price Tag MakerMake printable price tags and shelf labels with sale prices and strike-through, on a cut-ready sheet.Risk Matrix GeneratorPlot named risks on a 3×3, 4×4 or 5×5 likelihood × impact heat map; export PNG, PDF or CSV.Stereogram GeneratorMake Magic Eye style 3D autostereograms from text, shapes or your own depth map.vCard QR Code GeneratorTurn contact details into a vCard QR code and a printable business card. PNG or SVG.Wedding Program MakerDesign printable wedding programs: folded, fan or tea-length, with order and party, PDF.Welcome Sign MakerMake wedding, shower and party welcome signs with names and date; poster-size PNG or PDF.Tiny Planet MakerTurn a 360° panorama into a tiny planet or rabbit hole photo with rotation, zoom and tilt.Recolor PNG IconChange the color of PNG icons and logos to any color or gradient, keeping transparency.App Icon GeneratorMake every iOS, Android adaptive, PWA and macOS app icon size from one image, as a ZIP.Birthday Card MakerMake a printable folded birthday card from templates with photos, stickers and fonts; PDF or PNG.Book Cover MakerDesign ebook and print book covers with trim sizes, spine width from page count, PNG/PDF.Brochure MakerMake tri-fold or bi-fold brochures from templates with panel guides and a two-sided print PDF.Comic Strip MakerMake comic strips with panel layouts, speech bubbles, captions and drawings; export PNG.
See all 142 Design & Graphics Makers →