Frontend System Design/Icon Rendering
Lesson 12 of 17 · Episode 12

Icon Rendering — Part 1

Approaches to shipping icons: the design space and the constraints.

IconsSVGTrade-offs
Watch on YouTube ↗

Icons look trivial — “just put a little picture there.” But how you render them quietly shapes performance, consistency, and the whole feel of an app. Before comparing techniques, this lesson builds the foundation: how images actually work, and what makes SVG special.

The setup

Why icons matter

Open any app and you'll count dozens of icons — in the nav, the sidebar, next to avatars, inside every button. Designers reach for them because they do two things text can't: convey meaning instantly and compactly (a 🔍 says “search” with no words), and invite action (a little trash can begs to be clicked). That ubiquity makes icon rendering a real system-design topic — especially in interviews, where high-level design questions almost always feature icon-heavy UIs.

The rubric

Four goals to optimize for

Every rendering technique we'll compare is judged against the same four goals. Keep them in mind — tap to expand:

The core distinction

Raster vs. vector

Every technique builds on one of two image families. Raster images (PNG, JPG, WebP) are a fixed grid of pixels — blow them up and the squares show. Vector images (SVG) store the math — points, lines, and curves — so the browser can redraw them crisp at any size. Drag the zoom and watch the difference:

Zoom: 3×
Raster (PNG)
fixed pixels — blocky
Vector (SVG)
math — redraws crisp
Why vector wins for icons
A raster icon needs a separate file for every size (and bigger files cost more bytes). A vector icon is a tiny set of equations the browser re-solves at whatever size you ask for — sharp at 16px or 1600px, from one small asset.
Look inside

Anatomy of an SVG path

That “math” is mostly the <path> element. Its d attribute is a list of pen instructions: Move (pen up), Line, Horizontal, Vertical, and Z to close. Step through them and watch the pen draw — the path is just these commands replayed:

Drawing an SVG path
M60 60Move the pen to (60, 60) — no line drawn
L60 200Line to (60, 200)
H220Horizontal line to x=220 (y stays)
V60Vertical line to y=60 (x stays)
ZClose the path back to the start
<path d="M60 60" />

Real icons combine many such paths (plus <circle>, <rect>, gradients), all wrapped in an <svg> container with a viewBox that defines its coordinate system. A <symbol> lets you define an icon once and reuse it by id with <use> — the key to SVG sprites we'll meet later.

A loading gotcha

The font-loading flashes

One technique renders icons as font glyphs — which inherits a classic web-font problem. While a custom font downloads, the browser either hides the text (FOIT) or shows a fallback then swaps (FOUT). Either way the user sees a flash:

FOIT· Flash of Invisible Text
Text is hidden until the font arrives — then it pops in.
FOUT· Flash of Unstyled Text
Welcome ✦
A system font shows first, then swaps to the custom one.
Note
Keep these two terms handy — they're a real downside of icon fonts, and a reason vector-SVG techniques (which ship inline, no font fetch) can feel snappier.
Practice

Check your understanding

Q1Sort each scenario
Raster or vector?
A PNG that pixelates when enlarged
An SVG stored as paths and shapes
A JPG photo thumbnail
Stays sharp at 16px and 1600px from one file
Q2Multiple choice
In an SVG path, what does the M command do?
Q3Multiple choice
FOIT and FOUT are problems associated with which technique?
Explore

Explore

Open your browser dev-tools on any site you like and:

  1. Inspect an icon — is it an <img>, an <svg>, or a font glyph?
  2. Zoom the page to 400% — which icons stay crisp and which blur?
  3. Find one <path d="…"> and spot the M / L / Z commands.
Key takeaways
  • Icons are everywhere, so their rendering affects performance, consistency, and flexibility — a real design topic.
  • Judge every technique on four goals: consistency, performance, maintainability, flexibility.
  • Raster = fixed pixels (blurs when scaled); vector/SVG = math (sharp at any size from one small file).
  • An SVG path is pen commands — M L H V Z — inside an <svg> with a viewBox; symbol+use enable reuse.
  • Icon fonts inherit web-font FOIT/FOUT flashes during loading.
← Previous
11. Pagination
Next →
13. Icon Rendering — Part 2