mat-icon Font to SVG Migration Helper
Move Angular Material mat-icon from the icon font to SVG: rewrites templates to svgIcon, downloads only the Material Symbols you use, and writes the MatIconRegistry code.
Material Symbols style
With ms, icons become svgIcon="ms:home", so they never clash with your own SVG icons.
How to Switch mat-icon From the Font to SVG
- Paste a template. Paste a component template or a .ts file with an inline template, or upload one. Ligatures, fontIcon and {{ interpolations }} are all found.
- Choose how to serve icons. A single sprite for most apps, one file per icon for very large sets, or icons inlined in the bundle for SSR and tests.
- Match your style. Pick Outlined, Rounded or Sharp, plus fill and weight. A fontSet in your template selects the style for you.
- Download and register. Download only the icons you use, paste the app.config.ts code, and replace the template with the rewritten one.
- Remove the font. Delete the icon font <link>, then repeat for the next template.
Icon Font vs SVG Icons in Angular Material
| Icon font (ligatures) | SVG with MatIconRegistry | |
|---|---|---|
| First load | The whole Material Symbols font, which is large because it holds every icon | Only the icons you use, often a few KB in total |
| Flash before load | The icon name shows as text (e.g. "home") until the font arrives | No text flash; the icon appears or the space stays empty |
| Ad blockers and offline | Breaks if fonts.googleapis.com is blocked | Served from your own domain |
| Colour and size | color and font-size | Same: currentColor and font-size still work with mat-icon |
| Variable axes (fill, weight) | Change at runtime with font-variation-settings | Fixed per file; download the variant you need |
<!-- Before: icon font -->
<mat-icon>home</mat-icon>
<mat-icon fontIcon="settings"></mat-icon>
<!-- After: SVG -->
<mat-icon svgIcon="home"></mat-icon>
<mat-icon svgIcon="settings"></mat-icon>Looking up an icon name? Search all Material Symbols in the mat-icon finder. For your own SVGs, the SVG to Angular component converter makes a standalone component, and the SVG Optimizer shrinks the files first. Planning a version upgrade too? See the Angular tools.
Frequently Asked Questions
- Why move mat-icon from the font to SVG?
- The icon font downloads every icon even if you use ten, shows the ligature text (like "home") until it loads, and fails when Google Fonts is blocked. SVG icons ship only what you use from your own domain.
- Do I need to change my CSS?
- Usually not. mat-icon sizes SVG icons to 24px like the font, and fill follows currentColor, so color rules keep working. If you resized icons with font-size, also set width and height on mat-icon, because the SVG fills the element rather than following the font size.
- Which serving option should I pick?
- A sprite file suits most apps: one cached request for all icons. One file per icon, with addSvgIconResolver, suits apps that use hundreds of icons but few per page. Inline literals avoid HTTP entirely, which helps server-side rendering, unit tests and libraries.
- What about icons set from a variable, like {{ item.icon }}?
- They are rewritten to [svgIcon]="item.icon". The registry only knows registered names, so type every value the variable can take into the extra names box and they are bundled too.
- Does this work with the legacy Material Icons font?
- Yes, for names that also exist in Material Symbols, which is nearly all of them. Names that only exist in the old font are highlighted, so you can pick a replacement in the Material icon finder.
- Which Angular versions are supported?
- The registry methods have existed since Angular Material 11. The generated config uses provideAppInitializer, added in Angular 19. On older versions, use APP_INITIALIZER with a factory, or call the registry in your root component constructor.
- Is my code uploaded?
- No. The template is scanned in your browser. The only network requests are for the icon SVGs themselves, from Google’s fonts.gstatic.com.
Sources & Standards
Last reviewed .
Related Tools
SVG to JSX ConverterTurn any SVG into a React (JSX/TSX), Angular, Vue or Svelte component with a size prop and currentColor. SVGO cleanup built in; nothing is uploaded.SVG OptimizerCompress SVG files with SVGO 4 in your browser. Before/after size, gzip size and preview, plus batch optimize up to 200 files to a .zip.SVG to PNG, ICO & FaviconExport an SVG as a sharp PNG, WebP or JPG at any size, a multi-size .ico, or a complete favicon set with Apple touch icon, maskable icons and manifest.Angular Material Icon FinderSearch 3,900+ Material Symbols and the legacy Material Icons by name or tag, preview Outlined, Rounded and Sharp, and copy <mat-icon> code, font links and SVGs.