Iconophor

Iconophor is an open-source CDN for popular SVG icon libraries that enables you to load icons as images or using CSS masks while still controlling the fill, stroke width, etc. via query parameters. Embedding the SVG source code inline is a common way to use icons in UI frameworks, but this can cause undesirable page bloat. Loading icons as images or masks instead can be beneficial for performance in some contexts by reducing duplicate markup and leveraging of caching.

Playground

/icons/heroicons/2.0.18/outline/academic-cap?height=96&stroke=pink

Icon libraries

Query parameters

Special query parameters

  • ?replace-colors

    Replace all fill and stroke attributes with a different value. This ignores attributes whose value is none. Can be used for example to set all colors to currentColor. Conversely, can also be used to remove all stroke and fill values by leaving the query parameter empty.

    ⚠️ May not work well with SVGs that contain multiple stroke or fill colors

  • ?symbol=true

    Turn a plain SVG into a symbol, wrapping the root element's children in a <symbol> element with id="icon". This enables loading SVG as external symbols.