Skip to content
viewsvg

SVG to JSX Converter

Paste an SVG and get a clean React, React Native, Vue or Svelte component, ready to copy into your project.

SVG code

Drop SVG files here

or paste SVG code in the editor.

Browse 28,000+ icons

Your SVG stays on this device. Nothing is uploaded.

Keyboard shortcuts

Open files
⌘/Ctrl O
Download SVG
⌘/Ctrl S
Paste SVG (outside editor)
⌘/Ctrl V
Zoom in / out
+ −
Zoom with mouse
⌘/Ctrl + scroll
Fit to screen
F
Actual size
1
Cycle background
B
Outline mode
O
Pixel grid
G
Pan
Drag, or scroll

Open from URL

The file is fetched directly by your browser. It only works if the server allows cross-origin requests (CORS).

How to use the SVG to JSX Converter

  1. 1

    Paste your SVG

    Paste SVG code or drop a file. Optimize it first in the Optimize tab for the smallest component.

  2. 2

    Choose a framework

    Pick React (JSX or TSX), React Native, Vue or Svelte. Set a component name and options such as currentColor.

  3. 3

    Copy or download

    Copy the component, or download it as a ready-to-use .jsx, .tsx, .vue or .svelte file.

Why SVG needs converting before it works in React

JSX looks like HTML but follows JavaScript rules. Pasting raw SVG into a React component usually fails or prints warnings, because hyphenated attributes like stroke-width and fill-rule must be camelCased, class must be className, and inline style strings must become objects. Namespaced attributes such as xlink:href and editor metadata from Illustrator or Sketch also need cleaning up.

viewsvg handles all of this and wraps the result in a named component that accepts props, so you can pass className, width or an aria-label from the parent.

Tips for SVG icon components

  • Run the SVG through the optimizer first to remove metadata and shrink paths.
  • Turn on Use currentColor so icons follow the text color and work in light and dark themes.
  • Turn on Remove width/height and size icons with CSS so the same component works at any size.
  • Keep the viewBox. Without it, the icon can't scale.

Everything you need to work with SVG

The SVG to JSX Converter is part of one workspace to view, edit, optimize and convert SVG files, with no sign-up, no ads and no uploads.

Instant preview

Zoom up to 6400%, pan, fit to screen, and check your SVG on transparent, white, black or any custom background.

Live code editor

Syntax highlighting, error line markers, format and minify, search, and full undo history.

Outline & pixel grid

See every path in outline mode, and check pixel alignment with the grid when zoomed in.

Inspect

File and gzip size, viewBox, element tree with hover highlighting, and one-click color replacement.

Optimize with SVGO

Shrink files with before and after previews and adjustable precision. Optimize every open file at once.

PNG, JPG, WebP & ICO

Export at any size up to 16384px, with transparency, or copy the PNG straight to your clipboard.

React, Vue & Svelte

Clean JSX/TSX, React Native, Vue and Svelte components with currentColor and props support.

Many files at once

Open many SVGs as tabs, then batch optimize or download them as a ZIP of SVGs or PNGs.

Private & offline

No uploads, no account. Your work is saved in your browser, and the app works offline after the first visit.

Frequently asked questions

What changes when converting SVG to JSX?

Attributes become camelCase (stroke-width → strokeWidth), class becomes className, xlink:href becomes xlinkHref, and inline style strings become style objects. viewsvg does all of this for you.

How do I make an SVG icon inherit text color in React?

Turn on "Use currentColor". Every fill and stroke is replaced with currentColor, so the icon follows the CSS color of its parent.

Does it support React Native?

Yes. Choose React Native and you get a component using react-native-svg (Svg, Path, G, and so on), with the matching import line.

Are my SVG files uploaded anywhere?

No. viewsvg runs entirely in your browser. Files are read, rendered, optimized and converted on your device, and nothing is sent to a server. After the first visit it even works offline.

Is viewsvg free?

Yes. Every feature is free with no sign-up, no watermarks and no file limits.

More free SVG tools