CSS Pattern Generator

Get background patterns as copyable CSS: no image file, no extra request, sharp at every zoom level and easy to recolour. Dots, polka dots, grids, lines, diagonal stripes and checks are drawn with CSS gradients alone. Graph paper, zigzag, plus and waves, which gradients cannot draw cleanly, come as a tiny inline SVG inside the CSS. Tailwind classes are included.

Pattern

Download as an image

px
px
Code
.pattern {
  background-color: #FFFFFF;
  background-image: radial-gradient(rgb(99 102 241 / 0.6) 2px, transparent 2.5px);
  background-size: 24px 24px;
}

Pure CSS gradients: no image file, and it stays sharp at any zoom.

Generating runs in your browser. What you type never leaves this device.

Features

  • Gradient-only CSS for dots, polka, grid, lines, vertical lines, diagonal stripes and checks

  • Inline-SVG CSS for graph paper, zigzag, plus and waves (marked "SVG")

  • Colours with opacity, spacing and line width or dot size

  • Copy as a CSS rule or Tailwind arbitrary-property classes

  • PNG and SVG downloads as well

Where CSS patterns shine

Section backgrounds

A faint dot grid or line pattern behind a hero or feature section.

Placeholders and empty states

Diagonal stripes for "drop here" areas, or checks behind transparent images.

Themes

Because the colour is in the CSS, a dark-mode version is one variable away.

How CSS patterns work

Gradients as drawing tools

  • Dots: a radial-gradient with a hard edge, repeated with background-size.
  • Lines and grids: linear-gradients that are coloured for the first few pixels and transparent after.
  • Diagonal stripes: a repeating-linear-gradient at 45 degrees.
  • Checks: a conic-gradient that colours two of four quarters.

Recolouring with CSS variables

Replace the colour in the copied CSS with var(--pattern-color) and set that variable per theme, for example a lighter colour in dark mode.

Keeping it light

Patterns behind text should be faint: 10 to 30% opacity. Gradient patterns are cheap to draw, but avoid animating them across large areas.

Related tools

CSS Pattern Generator - FAQ