SVG to React Converter

Convert SVG markup or files to React components in JSX or TypeScript (TSX). Preview the SVG, name the component, and copy or download the code in your browser.

Convert SVG markup to a React component

Paste an SVG from a design tool or open an .svg file. Try the example to see how a gradient and stroked path translate into React. The converter keeps the SVG’s viewBox, shapes, and definitions such as gradients, masks, and clipping paths. It uses React attribute names such as className, strokeWidth, and fillRule, and turns inline CSS declarations into a style object.

Choose JSX or TSX and use the component

Give the component a name such as ArrowIcon. Choose JSX for JavaScript or TSX for TypeScript with typed SVG props. Copy the code or download it as a .jsx or .tsx file. The component is a default export. Import it into your React project, then pass props such as className, width, height, or aria-label to its root SVG. The code uses the modern JSX transform.

Check embedded styles and references

Conversion happens in your browser. The preview displays the SVG as an image, which may omit external fonts and images. Scripts, inline event handlers, editor metadata, and embedded HTML in foreignObject are left out of the component. Local IDs and stylesheet selectors are kept as written. Give IDs and CSS selectors unique names if multiple SVGs on the same page use the same ones, or if you render several copies of a component that uses IDs.

Show more related tools