SVG to JSX Converter
Convert SVG markup to React JSX components — paste, configure, and copy instantly.
Converted JSX will appear here...About SVG to JSX Converter
SVG to JSX Converter is a free online tool that transforms raw SVG markup into React-compatible JSX functional components. SVG files exported from Figma, Illustrator, or icon libraries contain HTML-style attributes that break in React: class must become className, stroke-width becomes strokeWidth, fill-rule becomes fillRule, and inline style strings must be rewritten as JavaScript style objects. This tool performs every one of those transformations automatically, wrapping the result in a named React component you can drop straight into your codebase.
Beyond attribute renaming, the converter gives you two workflow options. "Expand Props" adds {...props} to the root SVG element so callers can pass className, onClick, aria-label, or any other prop without modifying the component. "Optimize SVG" strips xmlns declarations, xml:space, version attributes, metadata elements, empty defs blocks, and XML comments — the cruft design-tool exports attach but React does not need. Both options can be toggled independently before you convert, so you get exactly the output your project requires.
Every conversion runs entirely in your browser using the native DOMParser. Your SVG code is never uploaded, logged, or transmitted to any server. That makes the tool safe for proprietary icon systems, client brand assets, and any graphic you are not ready to share publicly. There are no rate limits, no account required, and no charge.
Key Features
Full attribute renaming
Every kebab-case SVG attribute — stroke-width, fill-rule, clip-path, stop-color, and dozens more — is converted to its camelCase JSX equivalent automatically.
Inline style string to object
style="fill: #fff; opacity: 0.5" becomes style={{ fill: '#fff', opacity: 0.5 }} so React can apply it without a runtime warning or error.
Named functional component output
The result is a complete const Arrow = (props) => (...); export default Arrow; block, not just a snippet — paste it into any .tsx or .jsx file and you are done.
Expand Props for reusable icons
Toggle "Expand Props" to add {...props} to the root SVG, letting consumers override size, color, or event handlers from outside the component.
Optimize option strips design-tool noise
Remove xmlns, xml:space, version, empty defs, metadata elements, and XML comments in one click — output is leaner and passes stricter linters.
Client-side, private, and free
The DOMParser runs in your browser tab. No server call is ever made, so proprietary icons and unreleased brand assets stay on your machine.
How to Use
Paste SVG
Copy your SVG code from a design tool or file and paste it into the input pane.
Configure Options
Set your component name, toggle props expansion, and choose whether to optimize the SVG.
Convert & Copy
Click "Convert" to generate the JSX component, then copy it to your clipboard.
Example
A Figma-exported alert icon with kebab-case attributes. After conversion, stroke-width becomes strokeWidth, the xmlns is stripped (Optimize on), and the output is a ready-to-use React component.
<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">
<circle cx="12" cy="12" r="10"/>
<line x1="12" y1="8" x2="12" y2="12"/>
<line x1="12" y1="16" x2="12.01" y2="16"/>
</svg> const AlertCircle = (props) => (
<svg width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor"
strokeWidth="2" strokeLinecap="round"
strokeLinejoin="round" {...props}>
<circle cx="12" cy="12" r="10" />
<line x1="12" y1="8" x2="12" y2="12" />
<line x1="12" y1="16" x2="12.01" y2="16" />
</svg>
);
export default AlertCircle; Common Use Cases
- arrow_circle_right
Importing Figma or Illustrator exports into React
Design tools export SVG with xmlns, xml:space, and kebab-case attributes that React rejects. This converter produces a JSX component you can import directly without editing the file by hand.
- arrow_circle_right
Building a custom icon library
Turn a folder of SVG icon files into individual React components with consistent prop APIs. Enable Expand Props so every icon accepts className and style overrides from the parent component.
- arrow_circle_right
Dropping inline illustrations into a landing page
Hero images and decorative graphics from a designer arrive as SVG files. Convert them to named JSX components so they live in your component tree, benefit from React re-renders, and stay out of the public folder.
- arrow_circle_right
Making SVG icons theme-aware with currentColor
Once the SVG is a JSX component, you can replace hardcoded fill or stroke values with currentColor and control the icon color purely via the parent element's CSS color property.
- arrow_circle_right
Fixing React warnings about unknown DOM attributes
If the browser console shows "Invalid DOM property: use strokeWidth instead", paste the SVG here to get a corrected JSX version in seconds rather than hunting through the markup manually.