Developer Utilities · Free tool
HTML to JSX
Transform raw HTML into valid JSX with className objects, self-closing tags, and SVG fixes online. A free, instant converter that runs in your browser with no signup.
Advertisement
What it does
Paste raw HTML and get valid JSX in return. The converter handles every reserved-word rename React requires —class becomes className,for becomes htmlFor,tabindex becomes tabIndex — plus camelCases all the on-* event handlers (onclick →onClick) and re-formats inline styles from a CSS string into a JS object literal.
Self-closing tags get fixed: <img>, <br>, <hr>, <input> all become explicitly self-closed (<img />) so the JSX parser is happy. HTML comments (<!-- ... -->) become JSX comments {/* ... */}. boolean attributes that React expects to be JS booleans (checked, disabled, readonly) are wrapped in braces.
Use this when you've copied a snippet from a design tool, a CodePen, an old jQuery plugin, or any non-React project and need it to compile inside a .tsx file without chasing 30 individual rename errors.
Embed this tool on your siteShow snippetHide
Paste this snippet into any page. Loads on-demand (lazy), no tracking scripts, and sized to most dashboards. Replace the height to fit your layout.
<iframe src="https://freetoolarena.com/embed/html-to-jsx" width="100%" height="720" frameborder="0" loading="lazy" title="HTML to JSX" style="border:1px solid #e2e8f0;border-radius:12px;max-width:720px;"></iframe>Example input & output
Input
<input type="checkbox" class="check" checked tabindex="0" onclick="doStuff()">Output
<input type="checkbox" className="check" checked={true} tabIndex={0} onClick={doStuff} />All four React conventions applied in one line: className, boolean wrap, camelCased tabIndex/onClick, and explicit self-close.
How to use it
- Paste the HTML snippet into the input box.
- The JSX output regenerates live — no convert button needed.
- Click Copy to grab the JSX, then paste into your React component's return statement.
- Wrap multiple top-level elements in a fragment (<>...</>) since JSX requires a single root node.
- If you see escaped braces ({` and `}) in your output, your input had literal curly braces — wrap them in {''} to keep them as text.
When to use this tool
- Migrating an old static site or jQuery template into React/Next.js.
- Pasting design-tool exports (Figma to code, Webflow exports) into a component.
- Converting Bootstrap/Tailwind HTML examples from documentation into JSX.
- Onboarding designers/non-React devs whose first instinct is to write plain HTML.
When not to use it
- Templating engines with custom syntax (Vue, Svelte, Handlebars) — those need their own converters.
- Server components with directives like "use client" — convert the markup here, but you still need to wire up the React-specific bits manually.
- Anything with <script> tags — React refuses to render <script> directly; use next/script or similar instead.
Frequently asked questions
- Why does React rename `class` to `className`?
- `class` is a reserved word in JavaScript (used for class declarations). React JSX is JavaScript, so the JSX-to-JS compiler needs a non-reserved alternative. `className` matches the DOM API name (`element.className` is how you read/set it in vanilla JS).
- What about CSS-in-JS — does this convert <style> tags too?
- Inline styles on individual elements (style="color: red; padding: 4px") get converted to JS objects ({color: 'red', padding: 4}). Standalone <style> tags are left alone — React renders them but it's usually better to extract them into a CSS module or styled-component.
- Does it handle data-* attributes?
- Yes. data-* and aria-* attributes pass through unchanged because React explicitly preserves them as-is (they're the only HTML-style hyphenated attributes JSX accepts).
- Why are my event handlers wrapped as strings instead of function references?
- If your input was `onclick="doStuff()"` (a string of code), the converter outputs `onClick={() => doStuff()}` to make it a callable. If you want a direct reference, change it to `onClick={doStuff}` after pasting — there's no way to know from raw HTML whether the function is in scope.
- Will this convert Vue/Angular templates?
- No — those have their own directive syntax (`v-if`, `*ngIf`, `:class`) that this converter doesn't recognize. Strip the framework directives first, leaving plain HTML, then run it through here.
Advertisement
Learn more
Guides about this topic
- Using Our Tools · GuideHow to generate QR codesMake QR codes for URLs, WiFi, vCard, or text. Learn error correction and sizing, then generate your QR code online free with no sign-up in seconds.
- Using Our Tools · GuideHow to create a strong passwordGenerate a strong password instantly online for free. Build high-entropy passphrases following NIST 2026 rules with no download needed.
- Developers & Technical · GuideHow to encode and decode Base64Understand the 3-to-4 mechanic and 33% overhead for standard, URL-safe, and MIME Base64. Free online reference to avoid common mistakes, no download needed.
- Design & Media · GuideHow to choose a color paletteBuild accessible color palettes using HSL theory, monochromatic to triadic schemes, WCAG contrast checks, and dark mode tips. Free, no-download guide.
- Developers & Technical · GuideHow to use JWT tokens securelyImplement secure JWT authentication by choosing RS256, setting expiration, using httpOnly cookies, and preventing 'alg: none' attacks in your browser for free.
- Design & Media · GuideHow to design a faviconCreate favicons that render perfectly from 16×16 to 512×512 with dark mode support. Learn the right HTML tags and web manifest setup free online.
Explore more developer utilities tools
- Port Number LookupSearch over 140 well-known TCP and UDP ports by number or service name. Free online reference tool with no sign-up, covering web, mail, DNS, and more.
- Test Credit Card NumbersReference table of canonical test card numbers from Stripe, Adyen, and Braintree sandbox docs. Plus Luhn validator + network detector.
- IPv6 Expander & ShortenerFormat IPv6 addresses to canonical form, handling zone IDs and prefixes, instantly online—free tool with no registration required.
- Htpasswd GeneratorCreate .htpasswd lines for Apache or nginx basic auth with browser-only SHA hashing instantly. Includes config snippets and a free online tool with no registration.
- Chmod CalculatorCalculate Unix file permissions: octal (755, 644) ↔ symbolic (rwxr-xr-x) ↔ rwx checkboxes. Covers setuid, setgid, sticky bit. With presets.
- Excel Formula ExplainerPaste any formula and get a plain-English breakdown of 60+ functions online free—no sign-up required, in your browser.