SVG to JSX Converter
Convert SVG to JSX online for free — paste SVG markup or open a file and get valid JSX or a ready-to-use React component, with camelCased attributes, className, style objects, {…props}, optional currentColor and TypeScript. Runs 100% in your browser.
100% private — everything runs in your browser. Conversion happens on your device; nothing is uploaded.
Converts attributes to JSX (stroke-width → strokeWidth, class → className, style strings → objects) and strips editor metadata. To shrink the SVG first, run it through our SVG Optimizer. Nothing is uploaded.
How to convert SVG to JSX
- Paste your SVG or open an .svg file.
- Set the component name.
- Choose options: React component, {…props}, TypeScript, currentColor, remove width/height.
- Copy the JSX or download the .jsx / .tsx file.
What you can use it for
- Turn icons from Figma, Illustrator or icon sets into React components
- Make SVG icons inherit text colour with currentColor
- Build a typed icon library in TypeScript
- Paste SVG into JSX without attribute errors
More free tools
Building for the web?
Format, minify, convert and generate code with our free, private developer tools.
See all free tools →Frequently asked questions
Why can't I paste SVG straight into React?
JSX uses camelCase attribute names (strokeWidth, not stroke-width), className instead of class, and style objects instead of strings. This tool rewrites all of those for you.
What does “Use currentColor” do?
It replaces fill and stroke colours with currentColor, so the icon takes the text colour of its parent — easy to theme with CSS.
Does it optimise the SVG?
It removes editor metadata, XML declarations and comments. For deeper optimisation, run the SVG through our SVG Optimizer first.
Is my SVG uploaded?
No. Conversion runs in your browser.
How do I use the React component in my project?
With Wrap in a React component ticked, which is the default, the output is a function exported as the default export and named after Component name, such as CheckIcon. Download it as CheckIcon.jsx, or CheckIcon.tsx with TypeScript on, add it to your project, then import it and render it like any other component, for example <CheckIcon />. Untick the option to get only the bare JSX for pasting into an existing component.
How do I pass a size or other props to the icon?
Keep Pass through {…props} ticked, which is the default, and the converter adds {…props} to the root <svg> after its own attributes, so values you pass, such as width, height, className or onClick, go onto the SVG and replace a matching attribute. Tick Remove width/height to drop the fixed size from the root element while keeping its viewBox, then size the icon with CSS or props.
What does the TypeScript option add?
Tick TypeScript and the component starts with import type * as React from "react", and its props are typed as React.SVGProps<SVGSVGElement>. The Download button then saves a .tsx file instead of a .jsx one. The type is only added while Pass through {…props} is on: with that option off, the function takes no arguments, so there is nothing to type and only the import line and file extension change.
Which attributes does it change, and which stay the same?
Hyphenated names become camelCase (stroke-width becomes strokeWidth, clip-path becomes clipPath), class becomes className, for becomes htmlFor and xlink:href becomes xlinkHref. data-* and aria-* attributes stay as they are, and names SVG already writes in camelCase, such as viewBox, gradientTransform and stdDeviation, are kept. Inline style strings become objects with camelCase keys; plain numbers stay unquoted, and CSS variables such as –size keep their name in quotes.
How is the component name chosen?
Type a name in Component name; the tool opens with CheckIcon. Opening an .svg file fills it in from the file name in PascalCase, so arrow-left.svg becomes ArrowLeft. Spaces, hyphens and other symbols are removed from the name in the code, and its first letter is capitalised. Leave the box empty and the component is called Icon. The downloaded .jsx or .tsx file uses the name as typed, with symbols removed.
Why does it say “That doesn't look like valid SVG markup”?
The converter reads your code as strict XML and needs the outermost element to be an <svg> tag. The message appears when parsing fails, for example because of an unclosed tag or an unquoted attribute, or when the code starts with a different element, such as an HTML <div> wrapped around the icon. Simple XML declarations, DOCTYPE lines and comments are removed before parsing, so you can leave them in.
Do I need an account, and can I use the code commercially?
No account or sign-up is needed: the converter is a script that runs on the page, and it adds no licence header, credit line or watermark to the output. The JSX is your own SVG rewritten, so you can use it in personal and commercial projects as far as that SVG allows. If the icon comes from an icon set or another designer, check that set's licence before you ship it.