Convert HTML to React JSX. Transforms class→className, for→htmlFor, inline styles to objects, self-closes void elements, and more.
${from}
→
${to}
HTML to JSX Converter automatically transforms standard HTML into valid React JSX syntax. It handles the most common pitfalls: renaming class to className and for to htmlFor, converting inline style strings into JavaScript style objects with camelCased properties, self-closing void elements like <br>, <img>, and <input>, converting HTML event attributes like onclick to their React camelCase equivalents (onClick), and replacing HTML comments with JSX comment syntax {/* */}.
The output can optionally be wrapped in a React fragment (<>...</>) or a full functional component scaffold. The conversion runs entirely in your browser — no code leaves your machine, making it safe for proprietary component markup.
When the converter encounters a style="..." attribute, it splits the CSS string on semicolons, converts each property name from kebab-case to camelCase (e.g. font-size → fontSize), and wraps the result in a double-brace JavaScript object expression: style={{fontSize: '14px', color: '#333'}}. String values are quoted; numeric pixel values remain as strings.
Yes. SVG-specific attributes such as stroke-width, fill-opacity, stop-color, and font-size are mapped to their camelCase React equivalents (strokeWidth, fillOpacity, stopColor, fontSize). The deprecated xlink:href is converted to simply href, which React supports for SVG elements in modern versions.
For most standard HTML, the output will be valid JSX that compiles without errors. However, complex cases — deeply nested templates with dynamic bindings, custom web components, or non-standard attributes — may require manual review. The converter covers the most common attribute mappings but does not execute or validate the JSX against a live React runtime.