HTML to JSX
Convert saved HTML to JSX with React attribute names, escaped text and form defaults. Review omissions and copy or download the component.
How to Convert an HTML Fragment to JSX
HTML to JSX: how to use it
- Paste an HTML fragment or open a UTF-8 .html file. Choose HTML document if you supplied a complete page with a doctype.
- Select Convert to JSX. Fix reported parse findings or review any omitted elements and attributes.
- Copy or download the React component. Review the output in your own React project, including styling and behavior you need to reimplement.
Limits and notes
Reads up to 250,000 UTF-16 code units and 120 levels of converted nesting. Supports common HTML elements and attributes. A document contributes its body contents. The converter leaves out inline CSS, inline event handlers, srcset, scripting and embeds, SVG, MathML and custom elements. This tool displays JSX as text. Rendering the component in a React app can load permitted external resources.
How your privacy works →HTML to JSX: common questions
Why did class and for change?
JSX uses React prop names such as className and htmlFor. The converter also closes void elements and puts literal text into JSX string expressions.
How do I keep the original styling?
Keep class selectors in your project's stylesheet. Move inline styles into CSS or translate them to a React style object after conversion.
Can I convert an entire HTML page?
Choose HTML document, starting with its doctype. The component contains supported body content. Review the report for omitted head content or wrapper attributes.