
Short answer
Use SVG for your website logo if you have a genuine vector file: it is sharp at every size and screen density, usually only 2–10 KB, and can change colour for dark mode with CSS. Use PNG (or WebP) exported at 2× the display size if your logo is photographic, has complex effects, came only as a raster image, or your platform does not allow SVG uploads. Either way, set width and height attributes and never lazy-load the header logo.
Key takeaways
- SVG is resolution-independent: one small file is sharp on every screen.
- An SVG that just wraps a PNG inside it is not a real vector — check before using it.
- WordPress blocks SVG uploads by default because SVGs can contain scripts; use a sanitising plugin or inline code.
- PNG is still the right choice for photographic or effect-heavy logos, and everywhere outside your own site.
- Width/height attributes prevent layout shift; eager loading keeps the logo fast.
The core difference
A PNG is a grid of pixels. It looks perfect at its exact size, fine when scaled down, and soft when scaled up. To look sharp on a retina screen, it must contain at least twice as many pixels as the space it occupies.
An SVG (Scalable Vector Graphics) is a text file describing shapes: paths, fills and strokes. The browser draws it fresh at whatever size and density is needed, so it is sharp on a 4K monitor, a phone and a printout — from one file.
SVG vs PNG compared
| SVG | PNG | |
|---|---|---|
| Sharpness on retina / zoom | Always sharp | Sharp only if exported at 2×–3× the display size |
| Typical header logo file size | 2–10 KB (simple logos) | 5–40 KB at 2× |
| Transparency | Yes | Yes |
| Change colour with CSS (dark mode, hover) | Yes, when inlined or using currentColor | No — needs a second file |
| Photographic / complex effects | Poor; files balloon | Good |
| Browser support | All modern browsers | Universal |
| Social media, email, marketplaces | Mostly not accepted | Accepted everywhere |
| CMS upload | Often blocked by default | Always allowed |
When SVG is the right choice
- You have the logo as a genuine vector (from your designer, or exported from Illustrator, Figma, Affinity or Inkscape).
- The logo is made of flat shapes and text converted to outlines.
- You want a dark-mode version without maintaining a second file.
- You care about every kilobyte on mobile.
Check that the SVG is real
Some SVG files are just a PNG wrapped in an SVG container — you get the downsides of both. Open the file in a text editor: a real vector has <path d="…"> elements; a fake one contains <image href="data:image/png;base64,…">. Another quick test: zoom the browser to 400% on the logo. A real SVG stays crisp.
Also check that text is converted to outlines. An SVG that uses <text> with your brand font will fall back to a system font on visitors’ devices that do not have it.
When PNG (or WebP) is the better choice
- The logo contains a photo, texture, complex gradients, glows or realistic shadows. As an SVG these become thousands of paths or embedded images and can weigh more than a PNG.
- You only have a raster file and no clean way to vectorise it. (Simple logos can be traced — see converting PNG to SVG.)
- Your site builder or theme does not accept SVG.
- The logo is going anywhere outside your website: social profiles, email signatures, marketplaces, documents — use PNG there.
For a PNG header logo, export at 2× the display size (e.g. 400 × 120 for a 200 × 60 slot) and consider WebP for a smaller file. Our format test shows the size differences.
SVG security and WordPress
An SVG is code, and code can include JavaScript. A malicious SVG uploaded to a site can run scripts when opened directly. For that reason WordPress blocks SVG uploads by default, and many other platforms restrict them.
Safe ways to use an SVG logo on WordPress:
- Install a plugin that sanitises SVGs on upload (for example “Safe SVG”), and only allow trusted users to upload them.
- Or paste the SVG code directly into your theme’s header template or a custom HTML block — only for a file you trust.
- Or keep using a PNG/WebP logo in the theme’s logo setting and add the SVG only via code.
Never upload SVGs from unknown sources. If you received an SVG from a third party, open it in a text editor and check for <script> tags or on…= attributes. You can also clean editor metadata and comments with the SVG Metadata Remover, which keeps the paths untouched.
Performance: making the header logo fast and stable
The header logo often appears in the first screen, so it can affect Core Web Vitals:
- Always set width and height attributes (or CSS aspect-ratio). Without them, the page jumps when the logo loads — that is Cumulative Layout Shift (CLS).
- Do not lazy-load the header logo.
loading="lazy"delays images near the top of the page. Leave it off, or usefetchpriority="high"if the logo is the largest element in view. - Keep it small. A header logo over 50 KB is almost always an oversized PNG.
<a href="/" class="site-logo">
<img src="/images/logo.svg" width="200" height="60" alt="Brightside Bakery home">
</a>
For a PNG with retina support, use srcset:
<img src="/images/logo-200.png" srcset="/images/logo-400.png 2x" width="200" height="60" alt="Brightside Bakery home">
Dark mode with SVG
If the SVG is inlined in the HTML and its shapes use fill="currentColor", the logo takes the text colour of its container — switch the text colour for dark mode and the logo follows. For an external SVG file, a <picture> element can swap files:
<picture>
<source srcset="/images/logo-white.svg" media="(prefers-color-scheme: dark)">
<img src="/images/logo.svg" width="200" height="60" alt="Brightside Bakery home">
</picture>
Our website header logo guide covers sizing for desktop and mobile headers in detail.
Alt text for logos
When the logo links to the homepage, the alt text should describe the link destination, e.g. alt="Brightside Bakery home". When it is purely decorative next to the company name in text, use alt="". Never stuff keywords into logo alt text.
Frequently asked questions
Is SVG or PNG better for a website logo?
SVG, if you have a true vector logo. It is sharp at every size, very small and can adapt to dark mode. Use PNG or WebP at 2× display size for photographic or complex logos, or when SVG is not allowed.
Why can’t I upload an SVG to WordPress?
WordPress blocks SVG uploads by default because SVG files can contain scripts. Use a plugin that sanitises SVGs or add the logo through code.
How do I know if my SVG logo is a real vector?
Open it in a text editor. A real vector contains path elements; a fake one contains an embedded base64 PNG image. Zooming to 400% should also stay perfectly sharp.
What size should a PNG website logo be?
Twice the size it is displayed at — for example 400 × 120 px for a logo shown at 200 × 60 — so it stays sharp on high-density screens.
Should I lazy-load my logo?
No. The header logo is visible immediately; lazy-loading delays it. Set width and height and load it normally.
Tools used in this guide
All tools run in your browser; your image files are not uploaded to our server.
Sources checked for this guide
- MDN: SVG documentation
- web.dev: Cumulative Layout Shift
- web.dev: browser-level image lazy loading
- WordPress.org: Safe SVG plugin
Platform upload rules change. We re-check the sources above when we update a guide; if you spot something out of date, send a correction.