SponsorHueclip · A moodboard maker for designers. Clip fonts, colors and screenshots. · Moodboard makerTry it
  1. Dashboard
  2. Svg Shape Background Image
Local Processing
MintConvertMintConvertMintConvert•100% Client-Side

© 2026 MintConvert. Files process locally in your browser and never touch a server.

All ToolsGuidesAboutFAQPrivacyTermsCookiesllms.txtDonate
Crafted byNikhil SaiNikhil Sai
MintConvertMintConvertMintConvert
Tools
PNG to SVGJPG to SVGWebP to SVGImage to SVGDXF to SVGGIF to SVGBMP to SVGICO to SVGTIFF to SVG
SVG to PNGSVG to JPGSVG to WebPSVG to ICOSVG Code to ImageSVG ConverterSVG to PDFSVG to STLSVG to DXFSVG to BMPSVG to GIFSVG to TIFF
SVG to CodeQR Code SVGBarcode Generator SVGSVG to Base64SVG FormatterSVG ValidatorSVG Sprite GeneratorBase64 to SVG
SVG ViewerSVG AnimatorSVG EditorSVG Background RemoverSVG CompressorSVG MakerSVG ResizerSVG CropperSVG Color ChangerSVG Rotate & FlipSVG MergerSVG Path EditorText to SVGSVG Wave GeneratorSVG Blob GeneratorSVG Pattern Generator
GuidesAboutDonate

How to Use an SVG Shape as a Background Image in CSS

Use an SVG shape as a background image in CSS. Covers sizing, stretching, placement, data URIs, changing color with masks and fixes for common problems.

November 27, 2026 · MintConvert Team

"A curve under a header or a soft shape behind a heading can lift a plain layout. With SVG, it stays sharp at any width. The tricky part is getting it to sit and stretch the way you intended.

Step 1: Prepare the shape

Save this as curve.svg:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20" preserveAspectRatio="none">
  <path d="M0 10 C25 20 75 0 100 10 V20 H0 Z" fill="#10b981" />
</svg>

You can also create a starting shape with the SVG maker, or pick a dedicated blob tool or wave tool. Our guide on how to make an SVG file covers other methods.

Step 2: Add it with CSS

.hero {
  min-height: 24rem;
  padding-bottom: 5rem;
  background-image: url("/shapes/curve.svg");
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: 100% 5rem;
}

The element needs its own size, from content, padding or a height. A background image doesn't make an empty box grow.

Step 3: Choose how it scales

Goalbackground-sizeResult
Show the whole shapecontainKeeps proportions; may leave space
Fill the areacoverKeeps proportions; may crop
Stretch a divider across100% 5remFixed height, full width
Repeat a small shape40px 40pxFixed tile size

To stretch a shape to different proportions, include preserveAspectRatio="none" in the SVG file. MDN explains the sizing rules for SVG backgrounds. Stretching suits curves, but it will distort circles and logos.

For a repeating design, the edges of the tile need to match. A pattern tool can build tiles for you.

Layer shapes over a color

.card {
  background-color: #f0fdf4;
  background-image: url("/shapes/corner.svg"), url("/shapes/curve.svg");
  background-repeat: no-repeat, no-repeat;
  background-position: top right, bottom center;
  background-size: 8rem auto, 100% 4rem;
}

Replace corner.svg with your second shape. The first image in the list is the top layer.

Inline the shape with a data URI

A very small shape can live in your stylesheet, which avoids a separate request:

.dot {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='4' fill='%2310b981'/%3E%3C/svg%3E");
}

Keep xmlns, and write # in colors as %23. An SVG to Base64 tool can prepare the encoded string. Separate files are easier to edit and can be cached on their own.

Change the color from CSS

Page styles such as fill don't reach inside a background SVG. For a one-color shape, use it as a mask:

.shape {
  height: 5rem;
  background-color: rebeccapurple;
  -webkit-mask: url("/shapes/curve.svg") center / 100% 100% no-repeat;
  mask: url("/shapes/curve.svg") center / 100% 100% no-repeat;
}

A mask hides parts of the whole element, including its text. Use it on an empty decorative element or pseudo-element, and test in the browsers you support.

Troubleshooting

ProblemWhat to check
Nothing appearsThe file path, and that the element has a width and height
Shape won't stretchpreserveAspectRatio="none" in the SVG
Data URI is blankMissing xmlns, an unencoded # or clashing quotes
External picture or font is missingSVG used as an image can't load external resources
Thin gap below a dividerCheck spacing and the bottom edge of the path

Key takeaways

Give the box a size, set repeat, position and size deliberately, and add preserveAspectRatio="none" only when distortion is acceptable. Use a mask when CSS needs to control a one-color shape.

Frequently asked questions

More articles

November 27, 2026

SVG Documents Explained: Structure, Elements and Examples

How SVG documents are structured: the root element, namespace, viewBox, groups, definitions, reuse, drawing order and the errors that stop a file rendering.

Read article
November 27, 2026

SVG Files for Cricut: Free Downloads, Licenses and Uploading

Using SVG files for Cricut? Learn where to get free downloads, how to check the license, how to upload to Design Space and how to fix files that look wrong.

Read article
November 27, 2026

SVG Image Element: How to Add Pictures Inside an SVG

Use the SVG image element to place PNG, JPG or SVG pictures inside a graphic. Covers href, sizing, cropping, shaped clips, embedding and missing images.

Read article
All articles

On this page