If you looked up what is svg, the short answer is that it is a vector image format written as text. The letters stand for Scalable Vector Graphics. The file describes shapes instead of storing a grid of pixels, giving a browser instructions for drawing an image at the size you need.
Drawing instructions, not pixels
Imagine a circle described by its center, radius, and color. Those few instructions are enough to draw it on a small button or a large banner. SVG uses basic shapes such as circles, rectangles, and lines, plus paths that describe more complicated outlines with straight segments and curves. Groups collect related elements so they can share styling or move together.
When the image grows, the browser redraws those vectors at the new scale; it does not stretch a fixed set of colored squares. The vectors therefore do not pixelate when enlarged. Text can remain text, rather than becoming outlines, although its appearance depends on the available font. A file can also embed a photograph. That photograph is still a raster image with a fixed number of pixels, even inside a vector document.
What is inside the file
Open the file in a text editor and you will see XML markup. The root svg element contains the drawing. Its xmlns namespace identifies the SVG vocabulary, so software knows how to interpret the elements. A viewBox defines the coordinate system used by the artwork. Optional width and height attributes specify dimensions; the page can also influence the displayed size.
Inside that root, paths and other elements describe the visible content. Presentation attributes such as fill and stroke, or CSS rules, determine colors and outlines. A design tool may add comments, metadata, and editor namespaces that preserve information for its own workflow. These design-tool leftovers are why a simple icon can be larger than expected: some of the text supports editing rather than the final drawing.
SVG Optimize is a free browser tool for people who need a smaller SVG without uploading the file. Use SVG Optimize to remove that extra markup locally. If you want to change the markup by hand, the SVG Editor lets you work with the source and see the drawing. Keep the exported original so you can return to its editable structure when needed.
When an SVG is the right file
SVG suits logos, icons, illustrations, and interface graphics built from clear shapes. One drawing can serve a navigation bar and a larger feature panel without requiring separate pixel dimensions for each use. Flat colors, curves, and geometric patterns are natural fits. Scalable artwork is especially useful when a layout adapts to different screens or visitors zoom into the page.
Photographs belong in raster formats such as PNG or JPEG. They contain fine textures and changing colors that are expensive to describe as individual shapes. Tracing a photo into paths can make a larger, slower file than a PNG, while changing its appearance. Asking what is svg useful for is therefore a question about the artwork, not just the filename: choose it for drawings that benefit from vector structure.
| Artwork | Better file | Why |
|---|---|---|
| Logo, icon, or flat illustration | SVG | Shapes are redrawn at the new size, so they do not pixelate. |
| Photograph, screenshot, or fine texture | PNG or JPEG | A pixel grid records the texture. Tracing it into paths can make a larger file. |
The W3C SVG specification describes SVG as a language for two-dimensional graphics in XML. The W3C PNG specification describes PNG as a format for lossless raster images.
How a page uses an SVG
An img element can point to a separate SVG file, much like another image format. The file is cached separately from the page, and the element can provide alternative text describing meaningful artwork.
Inline markup places the drawing directly in the HTML document. Its elements can be styled by the page CSS, which is useful when a graphic needs to share interface colors or respond to a component state.
A CSS background can use an SVG for decoration, such as a repeating pattern. Background images do not provide image alternative text, so essential information should also appear in the page content.
An object element can load a separate SVG document, while an SVG image reference can include another image within a drawing. Choose the approach that fits the document structure and test any resources the referenced file needs.
Making a large SVG smaller
Start by considering what occupies the file: editing data, repeated styling, long paths, or an embedded photograph. Removing unnecessary markup can help, but it cannot turn a detailed photograph into a simple vector drawing. For several files, use SVG Compressor and review each result separately before saving it.
Preview the result before replacing the original, then check it at the sizes used on your page. Rounding coordinates and removing attributes can change curves, colors, sizing, or references. Keep useful text and accessibility information in mind as well. A smaller download is only an improvement when the graphic still looks and works as intended.
Frequently asked questions
Is an SVG a picture or a text file?
It is both: a picture described by a text file. A browser reads the XML markup and draws the result, while a text editor shows the instructions. If you are asking what is svg because a downloaded image opens as code, that is the expected underlying format.
Does an SVG get blurry when it is scaled up?
Its vector shapes can scale up without the pixelation caused by enlarging a fixed pixel grid. However, a photograph embedded in the file still has a limited resolution and can become blurry. Deliberate blur effects and the way thin lines align with screen pixels also affect appearance.
Is an SVG always smaller than a PNG?
No. A few shapes may take little text to describe, but complex paths, embedded photographs, and extra markup can produce a large file. Tracing a photograph can add thousands of coordinates. Compare suitable exports of the actual artwork instead of choosing by the file extension alone.
Can browsers display SVG without a plugin?
Yes. Modern browsers have built-in support for displaying SVG files, including through an HTML image element. Visitors do not need a separate viewer or browser plugin. Check the finished page because fonts, external resources, and the way the image is included can still influence what appears.
Should a design-tool SVG be optimized before it is published?
Usually it is worth checking an export for unnecessary markup before publication. Keep an editable original, inspect the smaller version, and test it where it will be used. Some changes affect the drawing or its references. You can review cleanup on your device before replacing the file.