SVG to JSX Converter

Paste an SVG and get clean JSX for React, or a ready-to-use component.

Your JSX appears here.

What the converter changes

  • Hyphenated attributes become camelCase, so stroke-width becomes strokeWidth and fill-rule becomes fillRule.
  • class becomes className, and namespaced attributes like xlink:href become xlinkHref.
  • Inline styles become objects, so style="stroke-dasharray: 2 2" becomes style={{ strokeDasharray: "2 2" }}.
  • Empty tags are self-closed, comments are removed, and the output is indented.
  • data- and aria- attributes stay as they are, because React expects them hyphenated.

Using the output as a component

Tick Wrap in a React component to get a component that passes its props to the SVG, so you can size and color it where you use it:

<Icon className="size-5 text-neutral-500" />

Rename it from Icon to something that describes the icon, then save it in your components folder.

Questions

Can I use an SVG directly in React?

Yes, but not as raw SVG markup. JSX needs attributes like stroke-width written as strokeWidth, class as className, and style as an object. Paste your SVG above to get a version React accepts.

Should I inline SVGs or use an <img> tag?

Inline the SVG as JSX when you want to change its color with currentColor, animate parts of it or pass props like className. Use an <img> tag for large illustrations that don't change, so the browser can cache them.

How do I change an icon's color in React?

Set fill or stroke to currentColor in the SVG, then set the text color on the icon or its parent, for example with a Tailwind class like text-neutral-500.

Does this work for React Native?

Not directly. React Native draws SVGs with the react-native-svg library, which uses capitalized components like <Svg> and <Path>. You can use this output as a starting point and rename the tags.

Is my SVG uploaded anywhere?

No. The conversion runs in your browser, and nothing is sent to a server.

Landings
Landing Page Examples
Copyright © 2026. All rights reserved.