HTML to JSX Converter
Paste HTML and get valid JSX instantly. Converts class to className, self-closes void elements, camelCases event handlers, and optionally transforms inline styles to JSX objects.
Last updated: May 20, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is HTML to JSX Converter?
When building React or Next.js components, you often start with plain HTML from a design mockup, a static site, a UI kit, or a copied snippet from the web. That HTML is not valid JSX — React's JSX syntax has several differences that cause compile errors if you paste HTML directly.
This converter handles all the common transformations: `class` becomes `className`, `for` becomes `htmlFor`, void elements like `<img>` and `<input>` get self-closing slashes, event handlers like `onclick` become camelCase `onClick`, and inline `style` strings can be converted to JSX style objects. The result is paste-ready JSX that works in any React component.
How to Use HTML to JSX Converter
Paste HTML into the input area or click "Load Sample"
Toggle options: Convert Style Strings, Convert Comments, Add Fragment
The JSX output updates instantly
Copy the JSX or download it as a .jsx file
Paste directly into your React component
Common Use Cases
- React developers converting HTML mockups or design prototypes into component JSX.
- Front-end engineers migrating static HTML pages to React or Next.js apps.
- Developers copying HTML snippets from documentation, UI kits, or Tailwind component libraries into React components.
- Teams converting email HTML templates into React email components.
- Bootcamp students learning the differences between HTML and JSX syntax.
- Developers converting CMS HTML output for use in React-rendered preview components.
Example Input and Output
A simple HTML form is converted to valid JSX with className, htmlFor, and a self-closing input.
<div class="form-container">
<form id="login" onsubmit="handleSubmit()">
<label for="email">Email</label>
<input type="email" id="email" class="input-field" readonly>
<label for="password">Password</label>
<input type="password" id="password" tabindex="1">
<button type="submit" class="btn btn-primary">Sign In</button>
</form>
</div><div className="form-container">
<form id="login" onSubmit={"handleSubmit()"}>
<label htmlFor="email">Email</label>
<input type="email" id="email" className="input-field" readOnly />
<label htmlFor="password">Password</label>
<input type="password" id="password" tabIndex={1} />
<button type="submit" className="btn btn-primary">Sign In</button>
</form>
</div>Privacy
All HTML to JSX conversion runs in your browser. No code is uploaded to any server.
After converting
Run the output through ESLint with the react/jsx plugin or paste it into your IDE to catch any remaining issues. Some attributes like aria-* and data-* pass through unchanged as they are already valid in JSX.

