Linear gradients are the most widely used gradient type in CSS, appearing in backgrounds, buttons, hero sections, and dividers across virtually every modern website.
Loading Gradient…
Set any angle from 0deg to 360deg
Add, remove, and position colour stops freely
Live preview updates as you adjust settings
Copy CSS output ready for any project
Drop the Gradient into any page — blog post, product docs, intranet, school portal — with a single line of HTML. Your visitors get the full tool, processed entirely in their browser. No backend, no uploads, no signup.
Embed code
<iframe
src="https://www.fixtools.io/css-tool/gradient?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="Gradient by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
A CSS linear gradient transitions colours along a straight line from one end of the element to the other. The direction of that line is specified either as a keyword (to right, to bottom, to top left) or as an angle in degrees measured clockwise from the top of the element. An angle of 0deg points upward and the value increases clockwise, so 90deg points right, 180deg points downward, and 270deg points left. The keywords map to specific angles: "to bottom" is equivalent to 180deg, "to right" is 90deg, and "to bottom right" is approximately 135deg on a square element. Choosing between keywords and angles is a matter of preference. Keywords are readable and self-documenting; numeric angles give precise control for diagonal designs that need an exact geometric angle rather than a corner-pointing direction.
Colour stops define where and how gradient transitions occur. Each stop is a colour value followed by an optional position. Without a position, the browser distributes stops evenly across the gradient line. With positions specified, you can compress or expand colour zones to create any blend ratio you need: linear-gradient(to right, red 0%, red 30%, blue 30%, blue 100%) creates a sharp two-zone split rather than a gradual blend. Stop positions can be in percentages, pixels, rem, or any valid CSS length unit. Browser support for CSS linear gradients without vendor prefixes is universal across Chrome, Firefox, Safari, Edge, and all major mobile browsers in versions released in the past several years, covering more than 99% of current web traffic.
FixTools generates the complete CSS linear-gradient() declaration based on your visual settings. Copy the output and apply it as background: linear-gradient(...) on any HTML element. The generated CSS requires no post-processing and works in any environment that supports standard CSS, from plain HTML files to React components to server-rendered templates in any language or framework.
Common mistakes with hand-written linear-gradient declarations cluster around a few specific patterns worth knowing. The most frequent error is reversing the direction syntax: developers familiar with mathematical conventions write 0deg expecting a left-to-right gradient and get a bottom-to-top result instead, because CSS measures angles clockwise from the top rather than counter-clockwise from the right. The second is forgetting that linear-gradient is an image, not a colour, so applying it to background-color silently fails. The third involves percentage positions: writing linear-gradient(to right, red 50, blue 100) without the percent signs produces an invalid declaration that is rejected entirely and falls back to no background at all. Finally, mixing colour formats inside a single gradient (hex, rgb, hsl, named colours) is legal but can produce subtle interpolation differences between browsers, so consistency within a declaration is the safer choice.
Configure your linear gradient direction and colour stops. Example output: background: linear-gradient(to right, #f093fb 0%, #f5576c 100%)
Step-by-step guide to linear gradient css generator:
Open the gradient tool
Click "Open CSS Gradient Generator" to launch the visual editor. Once it loads, locate the gradient type selector at the top of the configuration panel and choose Linear Gradient to ensure you are working with the linear-gradient() function rather than the radial type.
Choose an angle or direction
Enter an angle in degrees from 0 to 360 in the angle input field, or select a directional keyword from the dropdown. Use 90deg or "to right" for a horizontal transition, 180deg or "to bottom" for vertical, or 135deg for a diagonal. The live preview updates immediately to show the effect of your chosen direction.
Add colour stops
Add at least two colour stops to define the gradient. Click the colour swatch of each stop to open the colour picker and set a hex, RGB, or HSL value. Drag each stop along the gradient track to set its percentage position. Click the add button to insert additional stops between existing ones for more complex transitions.
Preview the result
The live preview shows your gradient applied to a sample element in real time. Resize the preview panel if available to see how the gradient looks at different element proportions. Long horizontal elements show angle and direction effects more clearly than square previews.
Copy the CSS
Click the copy button beside the output field to copy the complete background: linear-gradient(...) declaration to your clipboard. Paste it directly into the CSS rule for your target element in your stylesheet, CSS module, or component file. No syntax changes are needed.
Common situations where this approach makes a real difference:
Navigation bar background
A developer wants a navigation bar that transitions from a brand colour on the left to a slightly darker shade on the right, adding depth to what would otherwise be a flat header band. They use the generator to produce a horizontal linear gradient between two tones of their primary brand colour, copy the CSS, and apply it to the nav element. The subtle directional shift provides visual richness to the navigation without introducing any colour that would compete with menu labels, logos, or action buttons in the header.
Button hover state
A designer wants primary buttons to have a gradient fill that reverses direction on hover for a polished interactive feel. They generate two linear gradients: one at 90deg for the default state and one at 270deg for the hover state. Both use the same two colour stops but in opposite directions. The first is applied as the default background, the second as the :hover background, with a CSS transition on background applied to smooth the swap. The result is an elegant directional flip animation on hover.
Progress bar fill
A developer building a skill or completion progress bar wants each bar to use a gradient fill rather than a flat colour to make the filled portion feel more dynamic. They generate a left-to-right linear gradient from a vivid start colour to a slightly lighter and brighter end colour, apply it to the progress fill element using background: linear-gradient(90deg, ...) with width controlled by a CSS variable, and achieve a result that makes static percentage bars feel energetic and visually interesting without any additional image or SVG assets.
Footer section transition
A landing page layout has a hard visual break between the main content area and the dark footer that looks abrupt and unpolished. The developer generates a short vertical linear gradient from the content background colour at the top stop to the footer background colour at the bottom stop, applies it to a transition div positioned between the content and footer sections, and eliminates the harsh horizontal edge. The gradient creates a smooth colour shift that guides the eye naturally from the body of the page into the footer.
Get better results with these expert suggestions:
Use "to bottom right" for quick diagonal without calculating degrees
Direction keywords like "to bottom right" are easier to read in CSS and require no mental calculation. They also adapt to the element's aspect ratio: "to bottom right" always points to the exact corner of the element regardless of its width or height, whereas a fixed numeric angle like 135deg uses the same geometric angle on every element. Reserve numeric degree values for situations where you need a specific non-corner direction such as a shallow 20deg tilt or a precise 60deg diagonal.
Create a hard colour stop by doubling a position
Placing two colour stops at the same percentage position creates an instant sharp transition with no blending between the two colours. For example: linear-gradient(to right, #667eea 40%, #764ba2 40%) splits the element into a solid left zone and a solid right zone. Combine multiple hard stops to build CSS-only striped or segmented patterns. This approach requires no images, no SVG, and no JavaScript, making it one of the most performant ways to produce stripe or checker effects in backgrounds.
Repeat gradients with repeating-linear-gradient()
The repeating-linear-gradient() function tiles the gradient pattern across the element. Define a short pattern with stops that cover only a small distance, such as from 0px to 20px, and the browser automatically repeats the pattern to fill the entire element. This is ideal for creating CSS-only diagonal stripe patterns, ruled line backgrounds, and progress indicators. The output is visually identical to a background image pattern but renders at any resolution and requires zero HTTP requests.
Smooth colour interpolation with oklch
Modern browsers support colour space interpolation hints in gradients. Adding "in oklch" after the function name changes how colours blend at midpoints: linear-gradient(in oklch, #ff0000, #0000ff). The oklch colour space produces more perceptually uniform midpoints and avoids the muddy grey band that can appear at the centre of sRGB gradients between complementary colours like red and blue. Use oklch interpolation when gradient midpoints look dull or desaturated in the standard sRGB default.
More use-case guides for the same tool:
Open the full Gradient — free, no account needed, works on any device.
Open Gradient →Free · No account needed · Works on any device