HTML → JSX Converter
Convert HTML markup to React JSX — className, camelCase attributes, self-closed void tags, and inline style objects.
About this tool
The HTML to JSX Converter transforms raw HTML into React-ready JSX by applying the attribute and syntax differences JSX requires: class becomes className, for becomes htmlFor, event handler attributes like onclick become onClick, and self-closing void elements (br, img, input, hr, meta, link, area, base, col, embed, source, track, wbr) get their required trailing slash.
Inline style attributes are converted from CSS text into a JSX style object — style="color:red; font-size:12px" becomes style={{ color: 'red', fontSize: '12px' }}, with CSS properties converted to camelCase. HTML comments are converted to JSX comment syntax. Attribute names that differ between HTML and the DOM property JSX expects — tabindex, readonly, maxlength, colspan, rowspan, autofocus, autocomplete — are all remapped automatically.
This is a pure string-transformation tool: no HTML is rendered or executed, so it's safe to paste markup copied from any source. An optional toggle wraps the converted output in a complete function-component scaffold, ready to drop into a new .jsx or .tsx file. If your input contains a <script> tag, a non-blocking warning is shown — script tags need manual review since raw script content and event wiring don't map cleanly onto React's component model. Common uses: porting a static HTML template into a React component, converting a designer's HTML mockup, or migrating a legacy jQuery page fragment.
