HTML to JSX Converter
Convert HTML to React JSX syntax — class→className, for→htmlFor, inline styles, and self-closing tags.
HTML Input
JSX Output
<div className="container main-wrapper">
<label htmlFor="username">Username</label>
<input type="text" id="username" readOnly tabIndex="1" autoComplete="off" />
<img src="/avatar.png" alt="User avatar" />
<br />
<hr />
{/* This is a comment */}
<p style={{ color: "red", fontSize: "16px", backgroundColor: "#fff" }}>Hello World</p>
</div>What gets converted
class=→className=
for=→htmlFor=
tabindex=→tabIndex=
readonly→readOnly
autocomplete=→autoComplete=
style="color: red"→style={{ color: "red" }}
<br>→<br />
<img src=...>→<img src=... />
<!-- comment -->→{/* comment */}
About HTML to JSX Converter
When migrating HTML templates to React, several attribute names and patterns need to change to conform to JSX syntax. JSX uses camelCase for most HTML attributes and reserves words like class and for (which are JavaScript keywords) — replacing them with className and htmlFor. Void (self-closing) elements must end with />, and inline styles must be JavaScript objects rather than strings. This converter handles all these transformations automatically using regex-based string processing.
Private & free — this tool runs entirely in your browser.
Recommended: IndieKit — Ship your Next.js startup in days.affiliate
Related Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to CSV
Flatten a JSON array of objects into CSV rows.
CSV to JSON
Parse CSV with headers into a JSON array of objects.
JSON to XML
Convert JSON structures into nested XML markup.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.
CSV to XML
Convert CSV rows into structured XML records.
XML to CSV
Flatten repeated XML records into CSV rows.