How to use the HTML to JSX Converter
- Paste your HTML.
- Optionally wrap it in a component.
- Copy or download the JSX.
What does this tool do?
React needs a few changes from plain HTML: class becomes className, for becomes htmlFor, style strings become objects, void elements like <input> must self-close and curly braces in text must be escaped. Inline SVG attributes such as stroke-width become strokeWidth. Event handler attributes are turned into placeholder functions to fill in.
Everything runs in your browser — nothing you paste is uploaded.
Why use it?
- Handles SVG and comments.
- Escapes { } in text.
- Optional component wrapper.
Use cases
- Move HTML templates and snippets into React components.
- Convert Tailwind UI or Bootstrap examples to JSX.
- Paste inline SVG icons into React.
Before and after
<label for="email" class="field" style="color: red; font-size: 14px">Email</label><input id="email">
becomes
<label htmlFor="email" className="field" style={{ color: "red", fontSize: "14px" }}>Email</label><input id="email" />
Common mistakes
- Forgetting to self-close tags like <img> and <br>.
- Leaving onclick strings, which React won't run — use real handlers.
- Pasting a full page with <html> and <head> into a component.
Privacy
Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.
Frequently asked questions
What happens to SVG attributes?
Dashed names like stroke-width become camelCase, such as strokeWidth.
What about event handlers?
They become placeholder functions for you to fill in.
Is my HTML uploaded?
No, everything runs in your browser.
Content last updated . See how M2Toolkit works.