SVG to React
Convert raw SVG from Figma or Illustrator into a clean React component — PascalCase name, props, camelCased attributes, SVGR-style output, free.
Loading tool controls…
Verify it yourself: press F12, open the Network tab, and use this tool — your files are never uploaded.
SVG to React at a glance
- Price
- Free
- Account
- Not required
- File uploads
- None — your files are never uploaded
- Category
- Developer Tools
Who uses Developer Tools?
Developers and engineers formatting JSON, testing regex, hashing data, encoding values or building API requests.
How to Use SVG to React
Follow these simple steps to get instant results in your browser.
Paste SVG
Paste SVG markup exported from Figma, Illustrator or any editor. A sample icon is loaded to try first.
Name the Component
Type a component name — it is converted to PascalCase automatically — and choose JavaScript or TypeScript.
Copy the Component
Copy the generated component into your project. A live preview shows the rendered SVG next to the code.
What is SVG to React & How Does It Work?
SVG to React converts raw SVG markup — the kind Figma and Illustrator export — into a clean React component. The output follows the conventions of SVGR, the standard tool for this job: a PascalCase component name, props for width, height and className, and every SVG attribute converted to React camelCase (stroke-width becomes strokeWidth, clip-path becomes clipPath).
Editor cruft is stripped first: XML declarations, DOCTYPEs, comments, data-name attributes and Illustrator metadata are removed, while gradients, masks and clip paths keep working. Inline style attributes become React style objects.
Toggle the TypeScript option and the component is typed as React.FC<SVGProps<SVGSVGElement>>, so the props are checked at compile time.
Key Features & Capabilities
SVGR-Style Output
PascalCase component, width/height/className props, camelCased attributes — the same shape SVGR produces.
Editor Metadata Stripped
Removes XML declarations, comments, data-name attributes and editor-specific attributes.
TypeScript Option
Generates a typed component with React.FC<SVGProps<SVGSVGElement>> when TypeScript is selected.
Live Preview
The converted SVG renders next to the code so you can confirm it still looks right.
Private by Design
Conversion runs entirely in your browser. Your SVG is never uploaded.
Pro Tips
- •Bookmark this tool for instant one-click access anytime.
- •Drag and drop files directly onto the input surface for fastest handling.
- •All processing happens in your browser session for maximum speed and data safety.
🎯 Common Use Cases
SVG to React - Layers icon component
The converter strips editor metadata, ids and fixed width/height, renames hyphenated attributes to camelCase (stroke-width → strokeWidth), and turns the fixed size into width/height props that default to 24.
Worked Example
- 1Input: <svg width="48" height="48" viewBox="0 0 24 24" fill="none"> + <path ... stroke-width="2" ... />
- 2→ export function LayersIcon({ width = 24, height = 24, className }: LayersIconProps) {
- 3return (
- 4<svg width={width} height={height} className={className} viewBox="0 0 24 24" fill="none">
- 5<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" stroke="#4F46E5" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" />
- 6</svg>
- 7);
- 8}
Sources & Further Reading
Frequently Asked Questions about SVG to React
Frequently asked questions
More Developer Tools
Complementary utilities for your workflow
SVG to React
Convert raw SVG into a clean React component.