Convert HTML into valid JSX: class becomes className, for becomes htmlFor, inline styles become objects and void elements are closed properly.
Waiting for markup
Renames the attributes JSX spells differently, closes void elements and converts inline styles to objects.
The JSX appears here
Ready to paste into a React component.
HTML to JSX Converter runs entirely on your device — nothing is uploaded.
You’re on the Free plan. Compare plans
JSX looks like HTML and is not HTML, and the differences are small enough to be annoying rather than obvious. `class` is a reserved word in JavaScript, so it becomes `className`. `for` is a reserved word too, so a label's attribute becomes `htmlFor`. `tabindex` becomes `tabIndex`, `maxlength` becomes `maxLength`, and so on through a list long enough that nobody remembers all of it.
Void elements have to be closed. `<br>` and `<img src="…">` are valid HTML and a syntax error in JSX, which must be `<br />` and `<img src="…" />`. This is the failure that stops a build rather than causing a subtle bug, and it is the first thing people hit when pasting a snippet in.
Inline styles become objects. `style="color: red; font-size: 14px"` is a string, and JSX wants `style={{ color: 'red', fontSize: '14px' }}` with camel-cased property names and quoted values. Boolean attributes change too: `disabled` on its own becomes `disabled={true}`, and `checked` without a value becomes explicit.
The conversion handles the mechanical part so you can spend your attention on the part that needs judgement — splitting the markup into components, deciding what becomes a prop. It does not try to do that for you, and it does not execute or render the HTML you paste: the markup is tokenised as text, which is what makes it safe to convert a snippet from somewhere you do not control.
class becomes className and for becomes htmlFor, because both are reserved words in JavaScript. Beyond those, most multi-word HTML attributes become camelCase — tabindex to tabIndex, maxlength to maxLength, colspan to colSpan — while data-* and aria-* attributes keep their hyphens exactly as they are.
Because JSX has no void elements. Every tag must be closed, so <br> and <img src="…"> need to be <br /> and <img src="…" />. Unlike most of these differences, this one is a syntax error rather than a silent bug.
Into an object with camel-cased keys and string values: style="color: red; font-size: 14px" becomes style={{ color: 'red', fontSize: '14px' }}. JSX does not accept a style string at all.
A bare disabled, checked or readonly becomes an explicit disabled={true}. HTML treats the presence of the attribute as true; JSX needs the value, because an empty string would be falsy.
No, deliberately. Where a component boundary belongs is a design decision about your application, and a converter that guessed would mostly guess wrong. This handles the mechanical renaming so your attention goes to the part that needs judgement.