SVG to JSX & React Component Converter

Paste an SVG and get valid JSX: class becomes className, stroke-width becomes strokeWidth, style strings become objects.

Loading the SVG to JSX tool…

Processed on your device. Files are never uploaded.

How to use the SVG to JSX tool

  1. Paste SVG code or drop a file.

  2. Choose component name, TypeScript, props spread and currentColor.

  3. Copy the component into your project.

What changes between SVG and JSX

JSX follows the DOM property names, so hyphenated attributes are camelCased (stroke-linecap → strokeLinecap), class becomes className, xlink:href becomes xlinkHref, and inline style must be an object. Namespaced editor attributes are dropped, and comments are removed because JSX handles them differently.

Questions

Do I need SVGR?

For a build pipeline that imports .svg files as components, SVGR is the standard. For converting a handful of icons by hand, this tool gives the same kind of output without adding a dependency.

Does it work for React Native?

Output targets react-dom. For react-native-svg, element names must be capitalised (Svg, Path); that is not done here.

Can the icon change colour with CSS?

Tick “Use currentColor” and the icon inherits the text colour of its parent.