b2KIT

CSS Sprite Generator

Generate CSS sprite sheets from multiple images with automatic CSS coordinate code.

Tested tool guide Tested browser tools Checked August 16, 2026

What CSS Sprite Generator does and how it behaves

CSS Sprite Generator turns multiple image files into one larger sheet and produces CSS background-position rules for the individual regions. The files remain in the browser while the sheet is created. Its coordinates describe offsets within the generated image, not positions on the page. The frequent surprise is that a rule alone does not define the visible crop: the receiving element must have suitable dimensions, and its background-image URL must point to the saved sprite sheet.

How the result is produced

1

Sheet coordinates

Each input image is assigned a rectangular area in the combined sheet. If an area begins x pixels from the sheet's left edge and y pixels from its top edge, selecting it as a CSS background requires an offset of -xpx -ypx. The emitted coordinate rules encode those offsets for the generated arrangement.

2

Visible region

Use the generated sheet as the element's background image and apply the coordinate rule for the desired source image. The element box acts as a viewport: pixels outside its width and height are not shown. Empty inline elements may also need a display mode that accepts dimensions, such as inline-block.

Good uses

  • Combining small navigation icons into one CSS-addressable image for an older site or constrained theme.
  • Building hover, active, and disabled image states that switch through background-position instead of separate image URLs.
  • Regenerating stylesheet offsets after images in an existing sprite sheet are added, removed, resized, or rearranged.

Limits and checks

  • Every offset is coupled to one exact sheet arrangement. If an image's position or dimensions change, replace the generated sheet and CSS together.
  • Transparent padding counts toward an image's rectangular region, so visible artwork can look misaligned even when its coordinate is correct.
  • Background sprites have no alt text. They suit decorative or separately labelled controls, not the sole representation of meaningful content.

Common questions

Can the sprite sheet contain images with different dimensions?

The CSS sprite technique permits differently sized source images. Each element that displays a sprite must still have a box sized for that image's region; a single shared width and height can crop larger images or expose adjacent pixels. Normalize the source canvases first if every icon must occupy an identical box.

Does the generated CSS make the sprites responsive or Retina-ready?

No. The generated coordinates select fixed regions of a sheet. To display a higher-resolution sheet at a smaller CSS size, you must set an appropriate background-size and scale every offset and element dimension consistently. Responsive changes that alter only the element size do not automatically recalculate which region of the sheet is visible.

References and verification

The behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools