Convert HTML to JSX Online

Convert HTML markup into React-ready JSX — class→className, style objects, self-closing tags.

Pasting raw HTML directly into a React component throws errors — JSX has its own naming conventions and syntax quirks. This converts HTML to valid JSX automatically.

Why "class" becomes "className" and other JSX quirks

JSX compiles down to JavaScript, and "class" is a reserved JavaScript keyword — React uses "className" instead to avoid the conflict. Similarly, inline `style` attributes must be JavaScript objects rather than CSS strings in JSX, which is why this tool converts that syntax too.

Frequently asked questions

Why do self-closing tags matter in JSX?

JSX requires every element to be explicitly closed — void HTML elements like `` or `
`, which don't need a closing tag in regular HTML, must be self-closed (``) in JSX or the code won't compile.

Does this convert JavaScript event handlers, like onclick attributes?

This tool focuses on structural conversion (className, style objects, self-closing tags) — inline event handlers typically need to be rewritten as proper React event handler functions rather than string attributes.