How to convert HTML to JSX
- Paste your HTML.
- Choose whether to wrap it in a React component.
- Copy the JSX or download it.
About this tool
Paste HTML and get JSX that React accepts. class becomes className and for becomes htmlFor, inline style text becomes an object, tags like img, input and br are closed, comments become JSX comments, SVG attributes such as stroke-width become strokeWidth, and onclick becomes onClick. You can wrap the result in a component.
Common questions
What about onclick and other event handlers?
They are renamed to onClick and so on and wrapped in a function. Inline code often needs rewriting to work as React code, so check them.
Why are there empty tags around my result?
JSX needs one outer element. If your HTML has several, they are wrapped in a fragment, written <>...</>.
Is my HTML uploaded?
No. The conversion runs in your browser.
Is it free to use?
Yes. There's no sign-up, and you can use it as often as you like.
Is my text uploaded anywhere?
No. This tool runs inside your browser, so what you enter stays on your device.
Do I need to install anything?
No. It works in your browser on a computer or a phone.