What the converter fixes
Pasting an SVG into a React or Vue component is a chore of attribute renaming — this tool does it in one step:
| Raw SVG | JSX output |
|---|---|
class="icon" | className="icon" |
fill-rule, stroke-width | fillRule, strokeWidth |
clip-path, stroke-linecap | clipPath, strokeLinecap |
xlink:href | xlinkHref |
style="fill:red" | style={{ fill: "red" }} |
<!-- comment --> | removed |
It also wraps the markup in a named component (set your own name instead of the default) and supports both React JSX and Vue SFC output.
Component, <img>, or inline?
Converting to a component isn’t always the right call. Three ways to use an SVG, by situation:
- React/Vue component — when you want props,
currentColortheming, or to bundle icons with your code. Best for design-system icon sets. <img src="icon.svg">— when the SVG is static, large, or from an untrusted source (it’s sandboxed and cached). Simplest for illustrations.- Inline in markup — when you need CSS to reach inside the SVG but aren’t in a component framework.
For a handful of recolorable UI icons, components win; for a big decorative graphic, an <img> reference is lighter.
Optimize before converting
The cleanest component starts from a clean SVG. Design-tool exports carry metadata, comments, and redundant attributes that survive into your JSX as noise. Run the SVG through the SVG Optimizer first, then convert — you’ll get a lean component instead of one littered with data-name attributes and editor cruft.
How this differs from SVGR
SVGR is the full build-time tool — Webpack/Vite plugins, a CLI, and deep configuration for transforming SVGs into components as part of your bundle. This browser tool covers the same core transformation for quick, one-off conversions with nothing to install. Use SVGR when you’re importing dozens of SVGs as components in a build pipeline; use this when you just need to convert a single icon right now. Everything runs locally, so proprietary assets stay on your device.