SVG Format
Scalable Vector Graphics
XML Structure
SVG stands apart from every other format on this site because it's not binary, it's just XML text. You can open an SVG in a text editor and read it. This makes metadata removal conceptually simpler, but it also means there are more places for information to hide.
Metadata can appear as dedicated elements, attributes on any element, XML comments, or processing instructions. Vector editors love to stuff their own data into SVG files.
Basic SVG Structure
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="100" height="100" viewBox="0 0 100 100">
<!-- Metadata elements -->
<title>My Drawing</title>
<desc>Created by John Doe</desc>
<metadata>
<rdf:RDF xmlns:rdf="...">
<!-- RDF/Dublin Core metadata -->
</rdf:RDF>
</metadata>
<!-- Vector content -->
<circle cx="50" cy="50" r="40" fill="red"/>
</svg>Key Elements
<svg>:Root element with viewBox and dimensionsxmlns:Namespace declarations<defs>:Reusable definitions (gradients, patterns)<g>:Grouping element
Metadata Elements
The SVG spec defines several ways to attach metadata, and different tools use different approaches. Some are obvious (there's literally a <metadata> element), others are more subtle.
<metadata>
Container for structured metadata, typically RDF/Dublin Core. Can contain creator name, creation date, rights, and more.
<metadata>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description>
<dc:creator>John Doe</dc:creator>
<dc:date>2024-01-15</dc:date>
</rdf:Description>
</rdf:RDF>
</metadata><title>
Human-readable title for the SVG or individual elements. Often used for accessibility but can reveal document purpose.
<desc>
Description element. Can contain detailed information about the image, creator, or purpose.
XML Comments
<!-- comment --> can contain author notes, creation dates, software info, or debug information.
Editor Namespaces
This is where SVG gets messy. Every vector editor adds its own namespaced attributes to store features that SVG doesn't support natively. Open an Inkscape file and you'll see inkscape: and sodipodi: attributes everywhere. These aren't privacy risks per se, but they do fingerprint your software.
inkscape:* / sodipodi:*
Inkscape adds namespaced attributes for layer names, guide positions, document settings, and edit history.
<svg xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
inkscape:version="1.2"
sodipodi:docname="my-drawing.svg">
<sodipodi:namedview inkscape:current-layer="layer1"/>
</svg>Adobe Illustrator
Illustrator embeds extensive metadata including version, artboard settings, and sometimes full AI format data.
xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" xmlns:x="http://ns.adobe.com/Extensibility/1.0/"
Sketch / Figma
Modern design tools may embed layer names, component IDs, and export settings in custom attributes.
Processing Instructions
XML processing instructions (<?...?>) at the start of SVG files can contain software identification.
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/css" href="style.css"?> <!-- Created with Inkscape (http://www.inkscape.org/) -->
Preserved vs Removed
- •
<?xml ...?>declaration:Preserved (required) - •
<?xml-stylesheet ...?>:Preserved (functional) - • Other processing instructions:Removed
DOM-Based Processing
Since SVG is valid XML, we can parse it into a DOM tree and surgically remove what we don't want. This is more precise than regex-based approaches and won't accidentally break valid content.
Parse XML
Parse SVG as XML document, preserving structure
Remove Metadata Elements
Delete <metadata>, <title>, <desc> elements
Strip Editor Attributes
Remove inkscape:*, sodipodi:*, and other editor namespaces
Remove Comments
Strip all XML comments from the document
Clean Namespaces
Remove unused namespace declarations from root element
Serialize
Write cleaned XML back as SVG file
Processing Summary
Preserved
- • All vector graphics (paths, shapes, text)
- • Styles and CSS
- • Gradients and patterns
- • Filters and effects
- • Embedded images (referenced)
- • viewBox and dimensions
- • Standard SVG namespaces
Removed
- • <metadata> element
- • <title> element
- • <desc> element
- • XML comments
- • inkscape:* attributes
- • sodipodi:* attributes
- • Adobe/Sketch namespaces
- • Unused namespace declarations
Embedded Images
Here's a gotcha that catches people off guard: SVG files can embed raster images as base64 data URIs. Those embedded JPEGs or PNGs might have their own EXIF metadata hiding inside.
Current Limitation
PicScrub currently removes SVG-level metadata but doesn't decode and process embedded raster images:
<image href="data:image/jpeg;base64,/9j/4AAQ..." />
PicScrub currently does not process embedded raster images within SVG files. For complete privacy, extract and process embedded images separately.