CSS Pattern Generator

Pick a pattern, two colours and how often it repeats. The CSS draws it with gradients alone, so there is no image file to load.

How it works

Every pattern is a small tile drawn with CSS gradients and repeated across the element. Stripes are one repeating-linear-gradient. Dots are a radial-gradient circle in each tile. Checks are one conic-gradient that colours two opposite quarters of each tile. A grid is two linear gradients, one for rows and one for columns.

Zigzag, triangles and waves layer several gradients with hard colour stops. Where layers need to line up, the CSS includes a background-position for each one.

The output is plain background declarations: background-color for the colour behind, then background-image, background-size and, where needed, background-position. It works in every current browser, and the preview on this page draws the exact CSS you copy.

How to use it

  1. 1 Choose a pattern.
  2. 2 Pick the shape colour and the background colour.
  3. 3 Set how often the pattern repeats, and for stripes, dots and grids, how thick the lines or dots are.
  4. 4 Press Copy CSS and paste it onto any element.

Good to know

  • Keep the two colours close in lightness for a quiet texture behind text, and check the text with a contrast checker.
  • A grid with 1 pixel lines in a faint colour makes a graph-paper background for diagrams and design tools.
  • Stripes at 45 degrees in a soft colour mark a disabled or in-progress area clearly without any icon.
  • Patterns are backgrounds, so they print only when the reader turns on background graphics in the print dialog.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

A graph-paper background for a whiteboard app

Say you are building a simple whiteboard and the canvas area needs a faint grid, like graph paper, so people can line things up. An image would work, but it would need a version for each theme and would blur on a high-density screen. A CSS gradient grid needs neither.

Choose Grid, set the shape colour to a light grey such as #e3e6ef and the background to white. Set Repeats every to 24 pixels and Line thickness to 1. The CSS comes out as a white background-color and a background-image of two linear gradients: one draws a 1 pixel line at the top of each tile, and the other, at 90 degrees, draws one down its left side. With background-size: 24px 24px, the lines meet in a grid of 24 pixel squares. Swap the colours for a dark theme, or put the line colour in a custom property and switch it with the theme.

Other patterns follow the same idea. Stripes at 45 degrees, repeating every 16 pixels with a 6 pixel stripe, make the familiar warning band for an area that is still loading or not available. Dots with a 4 pixel dot every 20 pixels make a soft texture for an empty state. Checks every 20 pixels give the grey and white board that design tools show behind transparent images.

Because the output is only background properties, it can be combined with anything else on the element. Put a solid colour or a gradient from the Gradient Generator in a second background layer, or add border-radius and the pattern clips to the corners. The preview here draws the exact CSS you copy, so what you see is what the browser will draw.

There are limits. Very small tiles, under about 4 pixels, can shimmer or blur when the page is zoomed, because the browser has to blend edges between device pixels. Hard-edged diagonal shapes, such as triangles and zigzags, show slight jagged steps on low-density screens. These patterns are backgrounds, so assistive technology ignores them and printers skip them unless background graphics are turned on. And the generator makes two-colour patterns only: for more colours, layer two patterns or edit the gradient stops by hand.

Frequently asked questions

Why use CSS gradients instead of an image?

A gradient pattern is a few dozen bytes of text, needs no extra request, stays sharp at any zoom and on any screen density, and can be recoloured by changing two values. An image needs a file per colour and size.

Do these patterns work in all browsers?

They use linear-gradient, repeating-linear-gradient, radial-gradient and conic-gradient, which every current version of Chrome, Edge, Firefox and Safari supports. Conic gradients, used for checks, need Safari 12.1 or later.

Can I put text on top of a pattern?

Yes, but busy patterns make text hard to read. Use a low-contrast pair of colours for the pattern, or put the text on a solid panel above it.

Why do thin lines sometimes look blurry?

When a tile size or line width does not land on whole device pixels, for example at 110 percent zoom, the browser blends the edge across two pixels. Whole-number sizes at 100 percent zoom stay crisp.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.