SVG to JSX / React Converter

Convert SVG markup to React component code with camelCase attributes and TypeScript support.

  1. Home
  2. Web Dev
  3. SVG to JSX Converter
Load Example
0 chars | 0 lines
0 chars | 0 lines

SVG Preview

Paste SVG markup above to see a preview.

What is SVG to JSX / React Conversion?

SVG (Scalable Vector Graphics) uses attributes like stroke-width and fill-rule with hyphens. In JSX/React, these must be converted to camelCase: strokeWidth, fillRule. This tool automates that conversion and wraps the SVG in a reusable React component with customizable props for color and size.

This tool runs entirely in your browser. No data is sent to any server.

How to Use This SVG to JSX Converter

  1. Paste SVG — Copy any SVG markup and paste it into the input area, or click Load Example.
  2. Configure — Set the component name, choose TypeScript, and toggle props for color and size.
  3. Preview — The SVG preview updates in real time. The converted JSX code appears automatically.
  4. Copy or download — Click the copy button or download the SVG file.

Frequently Asked Questions

What attributes get converted to camelCase?

All hyphenated SVG attributes: stroke-widthstrokeWidth, fill-rulefillRule, clip-pathclipPath, xmlns is removed, and class becomes className.

What does "Color as Props" do?

It replaces hardcoded stroke and fill values with {color} or {color || 'currentColor'}, allowing the parent component to control icon colors via props.

What does "Size as Props" do?

It replaces width and height on the SVG root element with {size} or {size || 24}, letting parent components control the icon size.

What is the difference between .jsx and .tsx?

JSX is standard React with JavaScript. TSX adds TypeScript type annotations, providing type safety for props like color and size with an interface definition.

Last updated: 26 Jun 2026