Dev TooloraLocal dev tools

> Images & Codes

SVG Pattern Generator

Generate a seamless SVG background pattern of dots, grid, diagonal lines, zigzag or checkers as a ready CSS rule.

Runs locallyWorks offline
Auto-run
Back to results
Input

Source data

Pattern
px
px
Dot diameter or line width. At most the tile size for dots, half of it for lines.
Output

Result

Your result will appear here.

Tool guide

About this tool.

  • An SVG pattern is a small tile that the browser repeats in both directions to fill a background. The tool draws the tile so its edges line up, then wraps it in a CSS rule that uses it as a data URI background image.
  • Dots place one circle in the middle of the tile. Grid draws a line along the top and left edges. Diagonal draws one line across the tile plus two corner stubs so the stripes continue across tile borders. Zigzag draws a three-point polyline, and checkers fills two opposite quarters.
  • The output is a .pattern rule with background-color (unless transparent), a background-image with the URL-encoded tile, and a background-size equal to the tile size. The tile itself is also available as pattern-tile.svg.

  • Subtle textures behind hero sections and cards.
  • Grid paper or dotted backgrounds for editors and dashboards.
  • Loading skeletons and placeholder areas.
  • Replacing a repeated raster image with a tiny, sharp, scalable tile.

Choose a Pattern, set the Tile size and Stroke size, then pick the Foreground and Background colors.

Turn on Transparent background to leave the background out.

The preview repeats the tile across a 320 by 200 area.

Copy the .pattern rule or download pattern-tile.svg. Values outside a slider range are rejected, never clamped.

  • Polka dots (24px tile, 2px dots) → one dot per tile
  • Grid paper (1px lines) → a thin slate grid
  • Diagonal stripes (16px tile) → continuous diagonal lines
  • Zigzag (32px tile) → a rose zigzag row
  • Checkerboard (40px tile) → dark and light 20px squares
  • Transparent dots → no background-color, so the pattern sits on any surface

  • Tile size is 4 to 200 px, stroke size 1 to 50 px.
  • For dots the stroke size is the diameter and may reach the tile size.
  • For lines the stroke size may be at most half of the tile size.
  • Colors must be opaque CSS colors.
  • Out-of-range values are rejected, never clamped.
  • The same settings always give the same CSS.

FAQ

Questions about SVG Pattern Generator

Why is the line width limited to half the tile?

Grid lines are inset by half their width so the full width shows inside the tile. The limit keeps a visible gap between lines and keeps zigzag peaks inside the tile.

How do I put the pattern on top of another color?

Turn on Transparent background. The tile then has no background rect and the CSS has no background-color.

Why is the data URI not Base64?

The URL-encoded form is smaller than Base64 and stays readable. Special characters such as # and < are percent-encoded.

Can I use the tile outside CSS?

Yes. Download pattern-tile.svg and use it as an image.

Continue with

SVG Blob GeneratorGenerate a smooth, seeded organic blob as SVG and shuffle its shape with one slider.SVG Wave GeneratorGenerate a seeded SVG wave divider with up to four layers, as a smooth random curve or a sine wave.SVG OptimizerReduce SVG file size while preserving view boxes, ids, classes and accessibility attributes.