HTML to JSX
Turn a static HTML snippet into a React-ready JSX component body. Runs entirely on your device. Attribute names are mapped to their React forms (class→className, for→htmlFor, tabindex→tabIndex, readonly→readOnly, colspan→colSpan, …), void elements (img, input, br, hr, …) are self-closed, HTML comments become {/* … */}, and the result is indented to two spaces. Dynamic values are not invented — static markup stays static strings, so the output is predictable and reviewable.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
HTML in, JSX out
Paste a static HTML snippet and get JSX for a React component body. Attribute names are mapped to their React spelling (class to className, for to htmlFor, tabindex to tabIndex and so on), void elements such as img, input, br and hr are self-closed, HTML comments become {/* ... */} and the tree is indented with two spaces.
When you are porting a static page
Use it when a design hand-off arrives as HTML, when you are lifting markup out of a template or a CMS export into a component, or when you want to confirm a snippet is valid JSX before committing it. It is deliberately a converter rather than a framework: it never invents props, state or event handlers.
The two options
Wrap multiple roots in a fragment encloses several top-level elements in <>...</> so the result is a legal component body instead of invalid sibling markup. Keep comments decides whether HTML comments survive as JSX comment expressions or are dropped, which is handy when comment blocks are template noise rather than documentation.
What it deliberately will not do
Inline style strings are carried through unchanged, because turning CSS text into a React style object needs a full CSS parser. Attribute values stay plain strings, and a value containing a double quote is wrapped in a JS expression so the JSX stays valid. Unbalanced markup is reported rather than guessed at.
Nothing leaves the page
The parse and render run in your browser and the snippet is never uploaded. Client markup, internal templates and half-finished components can all be converted without a network connection.
Questions
Does it convert CSS style strings to style objects?
No. inline style="…" strings are carried through unchanged as strings. Converting to React style objects would need a CSS parser and is out of scope for a markup converter.
Why are void elements self-closed?
JSX requires every element to have a closing form, so img, input, br, hr, meta, link and friends are emitted as <img />, <input /> etc. HTML attributes are otherwise passed through.
What about attributes I add later with expressions?
Static input produces static JSX. You can replace any attribute value with an expression afterwards; the converter keeps values as plain strings so nothing is guessed.
Can it handle multiple root elements?
Yes — with "Wrap multiple roots" enabled, several top-level elements are wrapped in a JSX fragment so the output is a valid component body.
Related tools
See categorySVG to JSX / React Component
Convert SVG or XML markup into JSX — camelCased attributes, style objects, optional component.
HTML to Markdown
Convert an HTML snippet or page into clean Markdown, on device, no server.
HTML Prettifier
Beautify HTML output — indented tags, one attribute per line for long tags, preserved text.
Markdown to HTML
Convert Markdown to HTML source code — see the generated markup, not a preview.