How to Download SVG from Webpage to Local Disk
Scalable Vector Graphics (SVG) rendered inside a web browser can be
saved to your local storage using built-in developer tools, direct file
exports, or a quick browser-console script. This guide covers how to
extract both inline <svg> code and externally loaded
SVG images from any website and convert them into standard
.svg files on your local drive.
Method 1: Copy Element via Developer Tools
This method works best for inline <svg> tags
embedded directly within the webpage HTML.
- Right-click the SVG image on the webpage and select
Inspect (or press
Ctrl + Shift + Ion Windows/Linux,Cmd + Option + Ion macOS). - The browser DevTools will open with the corresponding element
highlighted. Locate the opening
<svg>tag. - Right-click the
<svg>node in the HTML tree, hover over Copy, and click Copy outerHTML (or Copy element). - Open a plain text editor such as Notepad, TextEdit, or VS Code.
- Paste the copied code into a new document.
- Save the file with the
.svgextension (for example,image.svg) and set the file type to “All Files” to ensure it does not save as a.txtfile.
Method 2: Save Linked SVG Assets
If the SVG is embedded via an <img> tag,
<object> tag, or CSS background, you can save the
source file directly.
- Right-click the graphic and select Save Image As… if available.
- If the option is unavailable, press
F12to open DevTools and switch to the Network tab. - Filter requests by selecting Img.
- Refresh the webpage (
Ctrl + RorCmd + R). - Look through the list for files ending in
.svg. - Right-click the SVG entry, select Open in new tab,
and press
Ctrl + SorCmd + Sto save the file to your disk.
Method 3: Trigger an Instant Download with JavaScript
You can automate the extraction and download process directly from the browser console.
- Right-click the SVG and select Inspect.
- Switch to the Console tab in the DevTools window.
- Paste the following script and press
Enter:
(function() {
const svg = document.querySelector('svg');
if (!svg) {
console.error('No SVG found on this page.');
return;
}
const serializer = new XMLSerializer();
let source = serializer.serializeToString(svg);
if (!source.match(/^<svg[^>]+xmlns="http\:\/\/www\.w3\.org\/2000\/svg"/)) {
source = source.replace(/^<svg/, '<svg xmlns="http://www.w3.org/2000/svg"');
}
const blob = new Blob([source], { type: 'image/svg+xml;charset=utf-8' });
const url = URL.createObjectURL(blob);
const downloadLink = document.createElement('a');
downloadLink.href = url;
downloadLink.download = 'graphic.svg';
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
URL.revokeObjectURL(url);
})();The browser will automatically package the SVG data and trigger a
file download named graphic.svg to your default download
directory.