Skip to main content
CalcChef

SVG Pattern Generator

Make a seamless SVG pattern tile of dots, squares, plus signs, stripes, checkers, hexagons or triangles; copy CSS with background-size or save SVG or PNG. How it works

Use the SVG Pattern Generator

Shape

Circle diameter.

Not used: a circle looks the same turned.

Pattern Presets

Live pattern preview

1×1
2×2
4×4
SVG Code
<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <pattern id="pattern" x="0" y="0" width="40" height="40" patternUnits="userSpaceOnUse">
      <circle cx="20" cy="20" r="10" fill="#007bff" />
      <circle cx="0" cy="0" r="7" fill="#60a5fa" />
      <circle cx="0" cy="40" r="7" fill="#60a5fa" />
      <circle cx="40" cy="0" r="7" fill="#60a5fa" />
      <circle cx="40" cy="40" r="7" fill="#60a5fa" />
    </pattern>
  </defs>
  <rect x="0" y="0" width="40" height="40" fill="#f0f9ff" />
  <rect x="0" y="0" width="40" height="40" fill="url(#pattern)" />
</svg>

Copy CSS adds background-size: 40px 40px so the tile repeats at its real spacing.

Export your pattern

Export PNG (repeats the tile at 40px spacing):

About the SVG Pattern Generator

A seamless SVG pattern is one tile that repeats edge to edge: here the tile is spacing x spacing for dots, squares, plus signs, stripes and checkers, spacing wide and spacing × √3 tall for hexagons, and spacing × √3 ÷ 2 tall for triangles, so the starting 40 px dots use a 40 x 40 tile. Anything that crosses an edge of the tile is drawn again on the opposite edge, and Copy CSS adds background-size: 40px 40px so the tile repeats at its real size.

Tile size by shape and spacing (width x height, px)

ShapeSpacing 20Spacing 40Spacing 100
Circle20 x 2040 x 40100 x 100
Rect20 x 2040 x 40100 x 100
Cross20 x 2040 x 40100 x 100
Line20 x 2040 x 40100 x 100
Checker20 x 2040 x 40100 x 100
Hexagon20 x 34.64140 x 69.282100 x 173.205
Triangle20 x 17.32140 x 34.641100 x 86.603

Copy CSS writes this size as background-size. Spacing goes from 10 to 200 px; sizes are rounded to 3 decimals.

The presets

PresetShapeSize (px)Spacing (px)OpacityRotationTile (px)
Polka DotsCircle12320.80°32 x 32
Diagonal StripesLine20280.945°28 x 28
HoneycombHexagon12340.850°34 x 58.89
CheckerboardChecker163210°32 x 32
Plus SignsCross14280.750°28 x 28
TrianglesTriangle24480.70°48 x 41.569
DiamondsRect20400.8545°40 x 40

Frequently asked questions

How do I use an SVG pattern as a CSS background?
Press Copy CSS. It copies three lines: background-image with the SVG as a data URL, background-size set to the tile (40px 40px for the starting dots, 34px 58.89px for the Honeycomb preset) and background-repeat: repeat. Paste them into the rule for the element that should carry the pattern.
Is the pattern seamless when it repeats?
Yes, for every shape: each part of a shape that sticks out over one edge of the tile is drawn again coming in from the opposite edge, so the edges meet. Stripes snap to 0, 45, 90 or 135° because only those angles repeat inside a square tile, so a rotation of 30° is drawn at 45° and the page says so.
Why are the Size or Rotation sliders grayed out?
A circle looks the same turned, and the checker, hexagon and triangle lattices have a fixed direction, so Rotation is disabled for them. Size is disabled for checker and triangle, whose cells fill the tile. For the other shapes an element is never drawn larger than the spacing: size 60 at spacing 40 is drawn at 40.
What does Color 2 do?
It draws a second set of shapes on the offset lattice: circles of 0.7 times the size on the tile corners for dots (radius 7 px around the starting 20 px dots), smaller squares or plus signs between the main ones, a stripe halfway between stripes, the other two squares of the checkerboard, the downward triangles, and a fill in every other hexagon. Untick Use a second color, or clear its hex box, to leave it out.
Can I download the pattern as SVG or PNG?
Yes. SVG downloads one tile as pattern.svg (40 x 40 for the starting dots). PNG comes as a square of 256, 512, 1024 or 2048 px, a banner or social size (1200 × 630 for a link card, 1500 × 500, 1920 × 1080 or 1080 × 1920) or a custom width and height from 1 to 4096 px, named for example pattern-1200x630.png, with the tile repeated at its real spacing rather than one tile stretched to fill it. Ctrl or Cmd + S downloads the SVG and Ctrl or Cmd + Shift + C copies the CSS.

Related Tools

View all tools