AI-generated backgrounds for websites: a production workflow

An image model makes a texture in seconds. Here is how to turn that output into a background that tiles, loads fast, keeps text readable and is safe to use.

8 min read
Square texture swatches of concrete, linen, leather and marbled ink on a dark slate table, one tile glowing teal
In short
  • Generate organic surfaces (paper, stone, fabric, gradients). Draw grids, stripes and anything with text in CSS or SVG.
  • Most models return about 1 to 1.5 megapixels. Upscale for heroes and inspect the result at 100 percent.
  • Fix tile seams with a 50 percent offset, and add 1 to 3 percent grain to stop banding in dark gradients.
  • Ship WebP or AVIF with a background-color fallback, check 4.5:1 text contrast, and save the prompt, seed and tool terms.
1.5 MPTypical size of a single image-model output
50%Offset on both axes that reveals tile seams
4.5:1Minimum contrast for body text (WCAG AA)

An image model can give you a new texture in thirty seconds. Getting that texture onto a live page is the slower part: the file is too small, the edges do not tile, the dark areas band, the text on top is unreadable and nobody is sure who owns it. This guide covers that second half, step by step, with the sizes, CSS and checks we use for our own sets.

The same workflow scales from one hero image to a pipeline that makes hundreds of brand-consistent variants. That larger version is usually a job for a team that offers custom generative ai development services, because it needs fixed prompts, seeds, review queues and storage, not just a chat window.

If you only need a finished background today, our free background library already passes every check on this page.

What are image models good at for backgrounds?

Image models are good at surfaces with no meaning: paper, plaster, fabric, stone, soft gradients, bokeh and abstract ink. They are weak at anything with exact structure, such as straight grids, readable text, logos, symmetric patterns and repeating geometry with a precise pitch.

That split decides the tool. Use a model for organic texture. Use CSS or SVG for geometry: a grid, stripes or dots drawn in code are sharper, weigh a few hundred bytes and never blur. Our guide to SVG pattern backgrounds covers that side.

Background typeGenerate it?Better option
Paper, linen, concrete, stoneYesModel plus a seam fix
Soft gradient mesh, glow, auroraYes, or CSSCSS gradients if the shapes are simple
Photographic scene behind a heroYes, with careCheck for odd details at full size
Grid, dots, stripes, isometric linesNoCSS or SVG pattern
Anything with text, a logo or UINoDesign it by hand

How do you write a prompt for a usable background?

Describe the surface, the light and the empty space, then exclude what you do not want. A background prompt is closer to a material spec than to an art brief.

  1. Surface. Name the material and its scale: "fine-grain recycled kraft paper, fibers visible at close range".
  2. Light. Flat, even light for tiles. Directional light only for single hero images, because a shadow direction breaks when the image repeats.
  3. Tone. Give the range: "mid-dark, no pure white, no pure black". This keeps room for text and for a dark mode version.
  4. Composition. "Top-down, orthographic, no focal point, uniform detail across the frame" for tiles. "Subject on the right third, empty space on the left" for a hero with a headline.
  5. Exclusions. "No text, no letters, no logos, no watermark, no frame, no vignette".

These modifiers change the result most:

ModifierWhat it doesUse for
seamless, tileableAsks for edges that matchRepeating textures
top-down, orthographicRemoves perspectiveTiles, paper, fabric
even, diffuse lightingRemoves hot spots and shadowsTiles
no vignetteStops dark cornersEverything that repeats or crops
negative space on the leftLeaves room for a headlineHero sections
low contrast, mutedKeeps detail quiet under textContent areas

Save the exact prompt, the model, the seed and the date next to the file. You will need them for a dark variant, for a matching second image and for any question about where the file came from.

Is the output big enough for a website?

Usually not. Most models return an image of about one to one and a half megapixels, for example 1024×1024 or 1536×1024. A full-width hero on a 1440-pixel laptop at 2x density needs 2880 pixels across. Plan the size first, then upscale.

UseTarget widthNotes
Full-width hero1920 to 2560 pxServe smaller copies to phones
Section or card background1200 to 1600 pxOur sets ship at 1600×1200
Repeating tile256 to 1024 px squareSmall is fine, it repeats
Mobile app screen1290 to 1440 px widePortrait crop, keep detail central

Upscale, then inspect at 100 percent

An AI upscaler doubles or quadruples the size and invents fine detail. On paper and stone that works well. On faces, hands, text-like marks and straight edges it adds artifacts. Zoom to 100 percent and scan the whole frame before you accept the file. A 2x upscale of a 1536-pixel image gives 3072 pixels, enough for any hero.

Tiles rarely need upscaling. A 1024-pixel tile repeated across a page looks sharp because each copy is shown near its real size.

How do you make a generated texture tile without seams?

Offset the image by half its width and height, fix the cross that appears in the middle, then test it repeated. A "seamless" prompt helps, but most models still leave visible edges.

  1. Crop to a square.
  2. Offset by 50 percent on both axes. In Photoshop use Filter, Other, Offset; in GIMP use Layer, Transform, Offset with wrap-around.
  3. The old edges now meet in a cross at the center. Clone or heal along that cross until it disappears.
  4. Look for a feature that stands out, such as a dark knot or a bright fleck. In a repeat it becomes a visible rhythm. Paint it out.
  5. Check the brightness on both sides. A left half that is lighter than the right shows as stripes when tiled.
  6. Test at real size with CSS before you export.
.tile-test {
  min-height: 100vh;
  background: #1a1b1e url(/img/linen-tile.webp) repeat;
  background-size: 512px 512px;
}

Our full method is in the guide to seamless tileable textures.

Why do dark generated gradients show bands?

The model renders smooth gradients, and 8-bit export plus lossy compression turns them into visible steps. The fix is a small amount of noise added before export. Banding is worst in dark blues, purples and greys, which is exactly where dark sites live.

Add 1 to 3 percent monochrome grain to the image. It breaks the steps, and the encoder keeps the gradient smooth. Our article on grain and noise in web design shows the settings, and the subtle grain gradient set is a ready example.

How do you compress and serve the file?

Export to WebP or AVIF, keep a JPEG only if you support very old browsers, and give the browser a choice. A generated PNG often weighs 1 to 4 MB. A good hero ends up between 80 and 250 KB.

  1. Resize to the target width first. Never ship a 3000-pixel image to a 400-pixel phone.
  2. Encode WebP at quality 75 to 82. Google's WebP documentation puts lossy WebP at 25 to 34 percent smaller than comparable JPEG.
  3. Try AVIF for large heroes. It usually saves more on smooth gradients.
  4. Check the decoded cost, not only the file size. A decoded image takes about 4 bytes per pixel, so a 2560×1440 hero uses around 14.7 MB of memory.

In CSS, image-set() lets the browser pick the format and density:

.hero {
  background-color: #14161a;
  background-image: image-set(
    url(/img/hero-texture.avif) type("image/avif"),
    url(/img/hero-texture.webp) type("image/webp")
  );
  background-size: cover;
  background-position: center;
}

The background-color is the fallback and the placeholder. Pick the darkest tone of the image so the page does not flash white while the file loads. MDN's image-set() reference lists the syntax and browser support.

Watch the LCP if the background is the hero

A CSS background is found late, after the stylesheet loads. When it is the largest element in view, it often sets Largest Contentful Paint, and web.dev rates an LCP under 2.5 seconds as good. Preload the file, or use an <img> with fetchpriority="high". Our guide to fast background images walks through both.

How do you keep text readable on a generated background?

Put a scrim between the image and the text and measure the result. Generated images often have bright patches you did not ask for.

.hero {
  background-image:
    linear-gradient(rgb(8 9 10 / .55), rgb(8 9 10 / .55)),
    url(/img/hero-texture.webp);
  background-size: cover;
}

The target is the WCAG contrast minimum: 4.5:1 for body text, 3:1 for large text. Measure on the brightest area that can sit behind a letter. Details are in our guide to readable text on background images.

Make the dark variant from the same prompt

For dark mode, do not just lower the brightness of the light file. Re-run the same prompt and seed with a darker tone range, or edit the light file into a dark one with lower internal contrast and no white highlights. Then swap it with a media query:

@media (prefers-color-scheme: dark) {
  .hero { background-image: url(/img/hero-texture-dark.webp); }
}

More on the visual side in backgrounds for dark mode.

Who owns an AI-generated background?

Check two things: what the tool's terms let you do, and what the law protects. They are not the same.

  • Tool terms. Most paid image tools allow commercial use of outputs. Free tiers sometimes do not. Read the terms of the plan you used on the day you generated the file, and keep a copy.
  • Copyright. The US Copyright Office holds that material generated by AI from a prompt alone is not protected by copyright; human authorship is required. You can use the file, but you may not be able to stop others from copying it. Substantial human editing can change that for the edited parts.
  • Provenance metadata. Some tools embed C2PA Content Credentials that record how an image was made. Many encoders drop metadata by default. Decide whether you want to keep it, and check the exported file.
  • Disclosure. Article 50 of the EU AI Act, which applies from August 2026, requires generative tools to mark their outputs in a machine-readable way. The disclosure duty for publishers targets deepfakes and certain public-interest texts, not abstract textures. A paper texture behind a pricing table does not need a label.

Our guide to free background licenses explains how this compares with stock and free libraries, and the Web Backgrounds license shows the terms for our own files.

What changes when you need hundreds of backgrounds?

The work moves from prompting to process. One designer can make five good backgrounds by hand. A product with seasonal themes, per-category banners or user-chosen app themes needs a pipeline.

  1. Fixed prompt templates with slots for material, tone and color, so every output belongs to one family.
  2. Style references or a tuned model to keep the brand look stable across runs.
  3. Automatic checks: size, file weight, average brightness, contrast against the planned text color, and a seam test for tiles.
  4. A human review queue. Automatic checks miss odd details, extra fingers and stray letters.
  5. A record per file: prompt, seed, model version, date and reviewer.

Teams that build this usually connect the image API to their CMS or design system, so an approved background lands in the right size and format without manual export.

A checklist before you publish

  • The subject is a surface, a gradient or a scene, not geometry, text or a logo.
  • The prompt, model, seed and date are saved with the file.
  • The file is at least as wide as the largest place it appears.
  • The upscaled file was inspected at 100 percent.
  • Tiles pass the 50 percent offset test and look even when repeated.
  • Dark gradients have light grain and show no bands.
  • The file is WebP or AVIF, resized, and the hero is under about 250 KB.
  • A background-color in the image's darkest tone is set as a fallback.
  • Text on top reaches 4.5:1 contrast on the brightest area.
  • A real dark variant exists if the site has dark mode.
  • The tool's commercial-use terms are saved.

Need something that already passes? Start with the soft gradient mesh backgrounds or browse background textures.

Questions about AI-generated backgrounds

Can I use AI-generated backgrounds on a commercial website?

Usually yes, if the terms of the plan you used allow commercial use of outputs. Save a copy of those terms. In the US, an image generated from a prompt alone is not protected by copyright, so you can use it but may not be able to stop others from copying it.

What resolution should an AI background be for a website?

Make it as wide as the largest place it appears: 1920 to 2560 pixels for a full-width hero, 1200 to 1600 for a section background, and 256 to 1024 pixels square for a repeating tile. Most models output less, so upscale heroes and check them at 100 percent.

How do I make an AI-generated texture seamless?

Crop it square, offset it by 50 percent on both axes, heal the cross where the old edges meet, remove any feature that stands out, then test the tile repeated with CSS at its real size.

Why does my generated gradient background look banded?

Eight-bit export and lossy compression turn a smooth dark gradient into steps. Add 1 to 3 percent monochrome grain before export, then encode to WebP or AVIF.

Do I have to label AI-generated backgrounds?

For decorative textures, generally no. The EU AI Act puts machine-readable marking on the tools, and its disclosure duty for publishers targets deepfakes and certain public-interest texts, not abstract backgrounds.

Keep reading

Built for the web.
Free to download.