For repeating decorative backgrounds, the choice in 2026 is between three approaches: pure CSS gradients (smallest, geometric only), SVG patterns (vector-perfect, complex shapes), or PNG tiles (legacy fallback). SVG wins when your shape is anything more complex than dots and stripes — hexagonal grids, isometric blocks, scaled fish-scales, abstract logos repeated. SVG patterns are also CSS-variable-friendly: change a single CSS custom property and the entire tiled pattern re-colors without regenerating the asset.
Our SVG pattern generator ships 60+ tested patterns with size, color, and density controls. Outputs three forms: standalone .svg file (use as background-image: url(...)), Base64 data URL (inline in CSS), or PNG export (legacy fallback). Patterns are seamless — the right edge meets the left edge cleanly, the top meets the bottom — so any tile size repeats without visible seams. This guide explains how SVG patterns are constructed, when SVG beats CSS or PNG, and the gotchas with anti-aliasing at tile boundaries.
SVG vs CSS vs PNG patterns
| Approach | File size | Best for |
|---|---|---|
| CSS gradient | ~80 bytes | Dots, lines, stripes, simple grids |
| SVG pattern | 300-1500 bytes | Triangles, hexagons, complex shapes, custom logos |
| PNG tile | 2-15 KB per tile | Photographic textures, complex non-geometric |
If your pattern can be expressed as gradients (dots, lines, grids), use CSS — smallest payload. If it’s geometric but more complex than gradients allow (triangles, hexagons), use SVG. If it’s photographic or organic (paper texture, fabric weave), use PNG.
SVG pattern anatomy
A typical SVG pattern is a repeating tile defined inside a <defs> block, then referenced as a fill:
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
<defs>
<pattern id="dots" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse">
<circle cx="10" cy="10" r="2" fill="#635BFF"/>
</pattern>
</defs>
<rect width="100%" height="100%" fill="url(#dots)"/>
</svg>
The <pattern> element defines a 20×20 tile with a single circle at the centre. The outer rectangle fills the entire SVG with that pattern. Change pattern dimensions, fill colour, or geometry — the pattern updates automatically.
How to generate an SVG pattern
- Open the SVG pattern generator
- Pick a shape from the gallery (60+ options across 5 categories)
- Adjust tile size, foreground color, background color, and density
- Watch the live preview render the seamless tile
- Export: standalone SVG file, Data URL (CSS-ready), or PNG rasterized at chosen resolution
Using SVG patterns as CSS backgrounds
Two ways to include an SVG pattern in CSS:
- External file:
background: url("/patterns/dots.svg") repeat;— saves a separate request, cacheable, scales with browser zoom. - Inline data URL:
background: url("data:image/svg+xml;utf8,<svg...>") repeat;— no extra request, theme-able with CSS variables.
For one-off patterns, inline data URLs save a round-trip; for patterns reused across many pages, external files cache better. For maximum flexibility, use a CSS variable for the pattern’s primary color: the data URL references it via fill="currentColor" or accepts injected colors via background-image stacking.
60+ shapes shipped with the generator
- Dots: uniform grid, scattered, halftone, polka, large/small mix
- Triangles: equilateral, scalene, isometric grid, chevron, sawtooth
- Hexagons: honeycomb, beehive, isometric, soccer-ball-style
- Lines: diagonal, crosshatch, sketchy, double-line, wave
- Scales: fish, dragon, oversized, miniature
- Geometric: circles, squares, plus signs, asterisks, stars, arrows
- Floral: abstract flower tile, art-deco fan
- Tech: circuit traces, schematic, blueprint grid
Common gotchas
- Anti-aliasing at seams. If your shape touches the edge of the tile, anti-aliasing can produce visible vertical or horizontal lines where tiles meet. Add 1px padding inside the tile (so shapes don’t touch the edge) or use SVG’s
shape-rendering: crispEdges. - Data URLs need careful escaping. Inline SVG in CSS data URLs needs URL encoding (
%,#,", etc.). Use?as a safe alternative for<if your CSS toolchain breaks. Our generator outputs already-escaped data URLs. - Vector but not infinite. SVG patterns scale with display zoom but the pattern tile size is fixed in the generator output. To make tiles scale with viewport, use CSS
background-size: 5vw 5vwor similar — but that distorts the pattern. - Custom fonts in patterns don’t work. If your pattern uses text glyphs (e.g., a tiled “★” character), include the font definition inline via
@font-facein the SVG itself, or use SVG path data for the character. External font files won’t load in SVG-as-image contexts. - Pattern size affects performance. Tiny tiles (under 8×8) render slower than larger ones because the GPU has to repeat them more times. For very fine patterns, use a 32×32 tile with multiple instances inside.
- Background-attachment: fixed + SVG patterns. Patterns repeat strangely with
background-attachment: fixedon some browsers. Test before deploying parallax-style background effects.
When NOT to use an SVG pattern
For simple geometric patterns (dots, lines, grids), use CSS gradients — smaller payload, same effect. For photographic or organic textures (paper, fabric, watercolor), use a PNG with proper compression. For animated patterns (drifting, morphing), use a CSS animation on the SVG itself or a canvas-based approach. For very large patterns where the tile is 1000×1000+, you’re better off with a real image — at that size SVG offers no advantage over PNG. For extremely tight performance budgets, even a small SVG pattern adds 500–1500 bytes; CSS gradients add 80.
Frequently asked questions
Are SVG patterns faster than PNG?
For most simple shapes: yes, smaller and faster. For very complex patterns or photographic-quality textures: no, PNGs (especially WebP or AVIF) compress better. Rule of thumb: if the pattern is geometric, SVG; if it’s organic, raster.
Can I edit the SVG pattern after generating?
Yes — the output is plain SVG markup. Open in any text editor, change fill values, adjust shapes inside the <pattern>, scale the tile dimensions. Or import into Figma / Illustrator / Inkscape for visual editing.
Will the pattern look the same on retina displays?
Yes — SVG is vector, so it renders pixel-perfect at any DPI. PNG patterns need 2× / 3× variants for retina; SVG doesn’t.
Can I use CSS variables for pattern colors?
Inside an SVG file referenced via external URL, CSS variables don’t propagate. For inline data URLs in your CSS, use currentColor in the SVG fills, then set color on the parent element to control the pattern’s primary color. For full theme support, generate the pattern programmatically and inject CSS variable values.
Is my data uploaded?
No. The generator runs in your browser. Pattern selections, customisations, and the generated SVG/PNG/data URL stay on your device.
Can I use these patterns commercially?
Yes — the generated SVG is your output, no attribution required. The shape templates are designed for any use including commercial work. The exception: if you upload your own custom shape and the original asset has licensing restrictions, those carry over to the generated pattern.
Related tools and guides
