Skip to content

HTML to JSX Converter

Convert HTML to JSX for React components instantly. Transforms class to className, style strings to objects, and self-closes void elements. Free online tool.

 

What changes from HTML to JSX?

JSX is a syntax extension for JavaScript used by React to describe UI. While it looks like HTML, JSX has important differences because it compiles to JavaScript function calls. This tool automatically applies all the required transformations: classclassName, forhtmlFor, inline style strings → camelCase style objects, boolean attributes → explicit JSX booleans, tabindextabIndex, and other attribute renames. Void elements (<img>, <br>, <input>, <hr>) are self-closed with />.

JSX conversion rules

Key transformations this converter performs: Attribute renamesclassclassName, forhtmlFor, tabindextabIndex, readonlyreadOnly, maxlengthmaxLength. Style objectsstyle="color: red; font-size: 14px" becomes style={{ color: 'red', fontSize: '14px' }}. Self-closing tags<img src="..."> becomes <img src="..." />. Event handlersonclickonClick, onchangeonChange. Comments — HTML comments become JSX comment blocks {/* comment */}. Enable the TypeScript toggle to generate TSX-compatible output.

Privacy

All conversion runs 100% in your browser. No HTML data is sent to any server.