A CSS background pattern generator with no images
This CSS background pattern generator builds repeating patterns entirely from CSS gradients. There is no image to download, so the pattern is sharp at any zoom level, costs only a couple of lines of CSS and can be recolored by editing two values. Nine patterns are available, each with a background color, a pattern color, an opacity and a size.
Example output
The default polka dots (teal on a pale mint background, 60% opacity, 24px tiles):
.pattern {
background-color: #f0fdfa;
background-image: radial-gradient(rgba(15, 118, 110, 0.6) 3.6px, transparent 4.6px);
background-size: 24px 24px;
}
Each dot is a radial gradient whose radius is 15% of the tile size. The extra pixel between the color stop and the transparent stop softens the edge so dots do not look jagged.
How the patterns are built
| Pattern | Technique |
|---|---|
| Diagonal, horizontal, vertical stripes | repeating-linear-gradient at 45°, 0° or 90°, half color and half transparent per repeat. No background-size is needed. |
| Polka dots | One radial-gradient per tile. |
| Checkerboard | A conic-gradient that fills two opposite quarters of each tile. |
| Grid lines | Two 1px linear-gradient layers, horizontal and vertical. |
| Zigzag | Four 45° triangles from angled linear gradients, offset with background-position. |
| Cross hatch | Two 1px repeating gradients at 45° and −45°. |
| Triangles | A 45° hard-stop gradient splitting each tile diagonally. |
Options explained
- Background – output as
background-color, so it also shows through transparent parts of the pattern. - Pattern colour and opacity – combined into one
rgba()value (5–100%). Low opacity gives a subtle texture behind text. - Pattern size – 6 to 120px; the tile size, or the stripe period for stripes.
Tips
- Keep text readable. Patterns behind body text should be low contrast. Around 10–20% opacity works for a texture.
- Layer it.
background-imageaccepts a comma-separated list, so you can place the pattern over a gradient from the CSS gradient generator. - Fixed to the page. Add
background-attachment: fixedto keep the pattern still while content scrolls. - Theme it. Replace the colors with CSS variables to switch patterns between light and dark themes.
For organic shapes rather than geometric repeats, try the SVG blob generator or the SVG wave generator.
Privacy
Patterns are generated in your browser; nothing is uploaded or stored on a server.