SuperDevTools

CSS Background Pattern Generator

Drag the bottom right corner of the preview to resize it.

Tip: the space bar also picks a random pattern.

Pattern

Settings

The third color is used for the offset dots, the large squares of graph paper, a second stripe, the downward triangles and the thin lines of the plaid.

CSS code

Everything is worked out in your browser: nothing is sent. The last pattern stays on this device.

Background patterns written in CSS, with no image file

This CSS pattern generator builds a background pattern from gradients alone: polka dots, staggered dots, grid, diagonal grid, graph paper, horizontal, vertical or diagonal stripes, checkerboard, zigzag, waves, diamonds, triangles and plaid. You see the result at full width, then copy a short snippet into your stylesheet. Handy for a hero banner, a landing page section or a slide background when you would rather not ship an image.

How to use it

  1. Pick a pattern under "Pattern". Every thumbnail uses your current colors.
  2. Set "Background color" and "Pattern color", and tick "Third color" on the patterns that support it.
  3. Adjust "Pattern size", "Thickness", "Angle" (diagonal stripes and diagonal grid only) and "Pattern opacity".
  4. Drag the corner of the preview to try other proportions, or switch to "Full screen".
  5. Choose "Properties" or "CSS variables", then "Copy code". "Copy link" reopens the tool with the same pattern.

"Random" (or the space bar) picks a new pattern with new colors; "Swap colors" exchanges background and pattern.

How it works: hard-edged gradients, repeated

When two color stops sit at the same position, a gradient stops blending and draws a sharp edge. A 40 px black and white checkerboard comes out as:

background-color: #ffffff;
background-image: repeating-conic-gradient(#000000 0 25%, transparent 0 50%);
background-size: 40px 40px;

The conic gradient paints every other quarter turn, and background-size sets the tile that the browser repeats across the element, so each square is 20 px wide. Polka dots rely on radial-gradient: with a #fef3c7 background, a #b91c1c color, a 20 px size and a 4 px thickness you get radial-gradient(circle, #b91c1c 4px, transparent 5px); the one-pixel gap smooths the edge of each dot. Stripes use repeating-linear-gradient. At 60° with a 6 px thickness, a third color of #0000ff and a 30 px size, the code reads repeating-linear-gradient(60deg, #b91c1c 0 6px, #0000ff 6px 12px, transparent 12px 30px). Richer patterns stack several comma-separated layers, each with its own size and position.

If the thickness you ask for does not fit in the tile, the tool reduces it and says so under the settings.

Lighter than an image

The snippet weighs a few hundred bytes, needs no extra download and stays crisp on high-density screens at any zoom level. Changing a color is a one-word edit instead of a trip back to a design app. One caveat: a tiny tile or a dozen layers on a very large area make the browser paint a lot, especially on elements that scroll or animate.

Text on top of a pattern

The tool measures the contrast of dark text and of white text at the worst spot of the pattern. For the red dots on cream above, dark text only reaches 2.91:1 over a dot and white text 1.11:1 over the background, so neither meets the 4.5:1 WCAG threshold for body text. Lower the pattern opacity, bring the two colors closer together, or put the text on a solid panel.

Frequently asked questions

Why export as CSS variables?

The color, image, size and position go into --pattern-color, --pattern-image and so on, so you can restyle a whole theme by editing one declaration.

Does it work in every browser?

Linear and radial gradients have been supported everywhere for years. The checkerboard and triangles use conic gradients, which current browsers support.

Why is my pattern cut off at the edge?

Tiles start at the top left corner of the element. A width that is a multiple of the pattern size avoids a partial row.

Are my settings saved?

The last pattern stays on this device. Nothing is sent anywhere: everything runs in your browser.