CSS Background Pattern Generator
About this generator
12 pure-CSS repeating patterns — dots, diagonal stripes, vertical stripes, grid, checkerboard, cross-hatch, triangles, zigzag, hexagons, topographic contours, plus signs, diamonds. Every pattern is built from linear-gradient / radial-gradient / repeating-linear-gradient stacked into background layers. No SVG. No PNG. No image requests. Renders at any size on any device.
10 curated presets covering common use cases (paper, blueprint, denim, noir, sunshine, editorial, hex-tech) with bg + fg + size + density + opacity dialed in. Tune any preset further with sliders, then export as either plain CSS or themeable (CSS-variable) form for easy dark-mode / brand-swap overrides.
Permalink: every adjustment encodes into the URL. No login, no watermark, no paywall. Free and MIT-licensed.
Why CSS patterns?
How to use this generator
Pattern reference
| Pattern | Technique | Best for |
|---|---|---|
Dots | `radial-gradient` + `background-size` | Soft backgrounds, polka motifs |
Diagonal stripes | `repeating-linear-gradient(45deg, …)` | Construction-zone, denim, sport panels |
Vertical stripes | `repeating-linear-gradient(90deg, …)` | Editorial layouts, ticket stubs |
Grid | Two `linear-gradient`s + `background-size` | Designer / engineering tools, graph paper |
Checkerboard | Four diagonal `linear-gradient`s tiled together | Transparency indicators, retro tile floors |
Cross-hatch | Two opposing `repeating-linear-gradient`s | Editorial illustrations, sketch feel |
Triangles | Two `linear-gradient`s at 60° with offset tiles | Modern, geometric, decorative |
Zig-zag | Four `linear-gradient`s at mirrored angles | Playful, energetic, brand panels |
Hexagons | Three `repeating-linear-gradient`s at 60° / 0° / -60° | Tech, sci-fi, gaming UIs |
Topographic | Stacked `radial-gradient` contour rings | Outdoor, mapping, hiking products |
Plus signs | Two `linear-gradient`s offset by half-tile | Healthcare, math, minimal motifs |
Diamonds | Two diagonal `linear-gradient`s offset to interlock | Argyle, classic textile motifs |
Common patterns
.hero {
background-color: #0f1419;
background-image:
radial-gradient(circle, rgba(167,139,250,0.35) 2px, transparent 2.5px);
background-size: 24px 24px;
}:root {
--pattern-bg: #fafafa;
--pattern-fg: rgba(10, 10, 14, 0.08);
}
@media (prefers-color-scheme: dark) {
:root {
--pattern-bg: #0f1419;
--pattern-fg: rgba(167, 139, 250, 0.18);
}
}
.surface {
background-color: var(--pattern-bg);
background-image:
linear-gradient(var(--pattern-fg) 1px, transparent 1px),
linear-gradient(90deg, var(--pattern-fg) 1px, transparent 1px);
background-size: 28px 28px;
}.banner {
background-color: #0d3a6b;
background-image:
repeating-linear-gradient(45deg, rgba(255,255,255,0.12) 0, rgba(255,255,255,0.12) 6px, transparent 6px, transparent 18px);
animation: drift 30s linear infinite;
}
@keyframes drift {
to { background-position: 200px 0; }
}
@media (prefers-reduced-motion: reduce) {
.banner { animation: none; }
}Pro tips
Frequently asked questions
Why CSS gradients instead of SVG or PNG patterns?
Three reasons. (1) Zero asset weight — the pattern ships as CSS, no extra image request, no DPI banding, no Retina downsizing. (2) Themeable — wrap the colors in CSS custom properties and dark mode / brand recolor becomes a one-line override (the generator's 'Themeable' output does this for you). (3) Infinitely scalable — the pattern renders at the element's full resolution, no matter how large. Trade-off: complex pixel-art patterns are easier in SVG; CSS gradients shine for geometric repeats.
How does the 'themeable' output work?
Standard mode embeds the bg + fg colors as literal hex values inside the gradient rule. Themeable mode lifts those colors into :root CSS custom properties (--pattern-bg, --pattern-fg) and references them via var() inside the pattern rule. To re-theme — for dark mode, brand swap, A/B test — just override the two custom properties at any level (a parent class, a media query, JS). One source of truth, no editing the gradient string.
Can I animate background patterns?
Yes. Animate background-position on a static pattern to scroll it (cheap, GPU-friendly). Animate the custom properties via @property + transition for color shifts. Animate background-size for the 'breathing' effect. Modern CSS @property even lets you animate gradient color stops directly. Common use cases: slow-scrolling marketing-section backgrounds, hover-triggered pattern shifts, loading-state stripes that move.
Why does the pattern look weird at certain sizes?
CSS gradient patterns are most readable at sizes ~12-48px. Below 8px the gradient stops can't resolve into visible features (Chrome / Safari snap to nearest pixel boundaries differently). Above 80px the pattern often becomes too large for the typical UI surface it sits behind. The generator's size slider defaults to 24px which is the sweet spot for most use cases.
Does this work on Safari / iOS?
Yes — all 12 patterns use only universally-supported CSS (linear-gradient, radial-gradient, repeating-linear-gradient, multiple background-image layers, background-size, background-position). Safari 9+, Chrome 27+, Firefox 16+, every iOS / Android browser since ~2016. The only feature with newer support is the themeable CSS-variable output, which works wherever custom properties do (everything since 2016).
Is this free for commercial use?
Free, MIT-licensed, zero attribution required, no watermark, no signup. Use on any project — personal, client, enterprise — without permission.