HTML to JSX Converter
Paste HTML and instantly get clean JSX output with className, htmlFor, camelCase events, self-closing tags, and style objects.
Start typing or paste HTML to convert.
Conversion Reference
| HTML | JSX | Note |
|---|---|---|
| class="…" | className="…" | Reserved word in JS |
| for="…" | htmlFor="…" | Reserved word in JS |
| onclick="…" | onClick={…} | camelCase events |
| style="color:red" | style={{ color: "red" }} | Object syntax |
| <br> | <br /> | Self-closing void elements |
| <!-- comment --> | {/* comment */} | JSX comment syntax |
Summary
Paste HTML and instantly get clean JSX output with className, htmlFor, camelCase events, self-closing tags, and style objects.
How it works
- Paste your HTML snippet into the left panel.
- The converter runs entirely in your browser — no data is sent to any server.
- Attribute names are mapped: class → className, for → htmlFor, etc.
- Event handlers (onclick, onmouseover, …) are camelCased.
- Void elements (input, br, img, hr, …) are self-closed with />.
- Inline style strings are converted to JSX style objects with camelCased property names.
- Copy the result with one click and paste it into your component.
Use cases
- Migrate static HTML templates into React or Preact components.
- Convert designer-supplied HTML mockups to JSX quickly.
- Learn JSX attribute differences when coming from plain HTML.
- Prototype UI components from copy-pasted browser DevTools HTML.
- Speed up porting Bootstrap or Tailwind HTML snippets to React.
- Fix "className is not a valid attribute" errors by batch-converting.
Frequently Asked Questions
Last updated: 2026-06-09 ·
Reviewed by Nham Vu