Practical note / SVG

Small icons.
Sharp thinking.

A crisp icon starts with a few quiet decisions: a sensible grid, a consistent stroke, and a check at the size it will actually be used.

01 Work with the pixel grid

Start with a 24 × 24 viewBox and draw for a 24-pixel display size. SVG strokes sit on the center of a path. A 2-unit stroke centered at x="8" extends from 7 to 9, placing both edges on pixel boundaries at a 1:1 scale.

Between the boundaries2 px stroke · x = 8.5
Edges on the grid2 px stroke · x = 8

Enlarged geometry, not a blur simulation. Each grid square represents one CSS pixel at 24 × 24. Diagonals and curves still need antialiasing.

A useful starting rule: at a 1:1 scale, center even-width strokes on whole coordinates and odd-width strokes on half coordinates. This helps straight horizontal and vertical edges; browser zoom, transforms, and display density affect the final rasterization.

02 Keep the SVG simple

Use one stroke weight, one cap style, and a little breathing room. This arrow uses a 2-unit stroke with rounded ends and joins. currentColor lets an inline SVG follow the surrounding text color.

ARROW-UP-RIGHT.SVG24 × 24
<svg xmlns="http://www.w3.org/2000/svg"
     width="24" height="24" viewBox="0 0 24 24"
     fill="none" stroke="currentColor"
     stroke-width="2" stroke-linecap="round"
     stroke-linejoin="round" aria-hidden="true">
  <path d="M6 18 18 6M6 6h12v12" />
</svg>
Actual-size check16 px24 px32 px

24 px is the native size. At 16 or 32 px, the stroke scales too; inspect the result instead of assuming every size will be equally crisp. An SVG loaded with <img> does not inherit the page’s text color.

03 Check it in context

An icon can be mathematically tidy and still feel off. Put it next to real text, on its real background, at the intended size. Then check the details that affect someone using it.

  • Keep the shape recognizable. Remove tiny details that disappear at 16 or 24 px. Compare related icons side by side.
  • Make meaning readable. Essential icon graphics need at least 3:1 contrast against adjacent colors. Visible normal-size text labels need at least 4.5:1.
  • Name the action. Use visible text when possible. For an icon-only button, add a clear aria-label to the button and hide its decorative SVG with aria-hidden="true".
  • Leave room to tap. A 24 px icon can sit inside a 44 × 44 CSS-pixel control. Check keyboard focus as well as pointer use.
A LINK WITH A VISIBLE NAME
<a href="guide.html">
  Read the guide
  <!-- Place the decorative SVG here. -->
</a>

The link text supplies the accessible name; the adjacent arrow is decorative. Keep the focus indicator visible.

A tiny set to start with.
Four icons, ready to edit.

Explore the SVG icons ↗