HTML to JSX Converter
Convert HTML into React/Preact JSX — class→className, style objects, self-closed tags. 100% in your browser.
class → className, for → htmlFor, inline style → object, void tags self-close, comments → {/* */}.
🔒 Runs in your browser — nothing is uploaded.
Convert HTML to JSX
Paste plain HTML and get JSX you can drop straight into a React or Preact component. It renames attributes to their JSX equivalents (class→className, for→htmlFor, event handlers to camelCase), converts inline style strings into style objects, self-closes void elements like <img> and <br>, and turns HTML comments into {/* … */}.
The conversion parses your markup with the browser’s own HTML parser and walks the result — so it handles nesting correctly and runs entirely on your device with nothing uploaded.
Frequently asked questions
Does it keep data- and aria- attributes?
Yes. data-* and aria-* attributes are valid in JSX as-is and are passed through unchanged.
Why is there a {' '} in the output?
It is a space that would otherwise disappear. JSX drops the whitespace at each end of a line, so a space next to an inline element has to be written as an expression — without it, a sentence with a link in the middle comes out with the words welded together. The contents of a pre block and any non-breaking spaces are kept for the same reason.
What about multiple top-level elements?
If your HTML has more than one root element, the output is wrapped in a fragment (<>…</>) so it’s valid to return from a component.
Is my HTML uploaded?
No. Parsing and conversion happen entirely in your browser.