SVG to JSX / React Component
Turn raw SVG (or other inline markup) into JSX/TSX that React accepts: kebab-case attributes become camelCase, class becomes className, inline style strings become style objects, comments become JSX comments, and empty elements self-close. Optionally wrap the result in a typed React component with a props spread. Everything runs on your device.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
What the SVG to JSX converter does
Paste SVG or inline markup and it returns JSX that React accepts: kebab-case attributes are camelCased, class becomes className, for becomes htmlFor, xlink and xml prefixes are collapsed, inline style strings become style objects, comments become JSX comments and empty elements self-close. It counts converted elements, attributes and style objects.
When to convert an icon here
Use it when you have an SVG from a design tool or the web and want it as a React or TypeScript component, or when you need a quick JSX fragment for an icon set and want the exact syntax React expects.
The options that shape the output
Wrap in a React component, on by default, adds an exported function with a props spread and names it after Component name (default Icon, sanitised to PascalCase). TypeScript adds an SVGProps import and types the props. StyleObjects toggles style-string conversion, and Indent sets the indent width from 0 to 8 spaces. Turning the wrapper off yields bare JSX.
What it does not check
Input is capped at one million characters. It reformats markup structure but does not validate geometry, references or accessibility, and nested style and script content is emitted as a template-literal child, which is what JSX requires.
Where the conversion runs
The markup is parsed and rewritten on your device in this tab; your SVG is never uploaded.
Questions
Which attributes are renamed?
class becomes className, for becomes htmlFor, xlink:/xml: prefixes become camelCase, and any hyphenated attribute is camelCased (stroke-width to strokeWidth). data-* and aria-* attributes are left exactly as written, and attributes without a dash such as viewBox keep their case.
How are inline style strings handled?
style="fill: red" becomes style={{fill: 'red'}}. Values stay quoted strings on purpose — React would add px to bare numbers, which changes rendering.
Is the whole SVG supported?
The converter works on markup structure, so any element or attribute name survives the trip. Nested <style> and <script> content is emitted as a template-literal child, which is what JSX requires.
Does it validate my SVG?
No. It reformats markup; it does not check geometry, references, or accessibility. Use your editor for that.
Related tools
See categorySVG to PNG
Rasterize an SVG image to a downloadable PNG.
HTML Prettifier
Beautify HTML output — indented tags, one attribute per line for long tags, preserved text.
JSON to TypeScript
Generate TypeScript interfaces or type aliases from a JSON sample, with nested named types.
HTML to Markdown
Convert an HTML snippet or page into clean Markdown, on device, no server.