HTML to JSX
HTML rewritten as JSX: class and for renamed, attributes given their DOM property names, style turned into an object, and void elements closed.
JSX to paste into a component, optionally wrapped in one, with a count of what was renamed and converted and a note for everything that has no safe JSX equivalent rather than a silent guess.
Example: class becomes className, for becomes htmlFor, tabindex becomes tabIndex, a style string becomes an object, and an inline onclick is dropped with a note instead of faked.
JSX looks like HTML.
It is not HTML.
Which names change and why, what becomes an object, and what this page refuses to guess at.
The renames are not cosmetic
JSX attribute names are DOM property names, not markup names. `class` collides with a reserved word so it becomes `className`; `for` becomes `htmlFor`; `tabindex`, `colspan`, `readonly` and several dozen others become their camelCase property names. But `data-*` and `aria-*` keep their hyphens exactly as written, because React passes those straight through to the DOM — a converter that camelCased them would break them. An unknown hyphenated attribute is left alone rather than guessed at, on the same principle.
Objects, braces and self-closing tags
A `style` string becomes an object with camelCased properties and string values. The values stay strings on purpose: React appends “px” to a bare number for most properties but not all, so a converter that dropped units would quietly change how the page looks. Every void element closes itself, because JSX has no void elements. A comment becomes an expression. A brace in ordinary text has to be escaped, or it becomes JavaScript. And a component may only return one node, so several top-level elements are wrapped in a fragment.
What is not converted
An inline `onclick` is dropped, with a note. It is a string of JavaScript evaluated against the global scope, and the JSX equivalent is a function reference in your component that only you can write — emitting `onClick="doThing()"` would look converted and do nothing, which is worse than leaving it out. A `<script>` or `<style>` block cannot hold raw text in JSX, so its content is emitted through dangerouslySetInnerHTML as a placeholder rather than lost. HTML entities are left as written: JSX understands the named ones in text but not inside attribute values. Nothing here validates the JSX, resolves components or splits a tree into them. Nothing leaves the browser; the same four anonymous usage counts as the rest of the site apply.
SOURCES
- JSX attribute names are DOM property names, so data-* and aria-* keep their hyphens while the rest are renamed; markup and syntax only, nothing is validated or executed
Last reviewed 22 September 2026. How results are checked: How we verify.