HTML to JSX Converter

Paste HTML — get React-ready JSX. Renames class/for, camelCases attributes, converts inline styles and self-closes void tags.

The HTML to JSX Converter transforms pasted HTML into React-ready JSX — renaming class to className and for to htmlFor, camelCasing attributes, converting inline style strings into style objects, and self-closing void tags. Paste markup from a template, Stack Overflow or a design tool and drop the JSX straight into a component.

  • class → className, for → htmlFor
  • Inline styles → style objects
  • Self-closes <br>, <img>, <input>…
  • 100% private — runs in your browser

What Gets Converted

HTMLJSXReason
class="box"className="box"class is reserved in JS
for="id"htmlFor="id"for is reserved in JS
style="color:red"style={{ color: 'red' }}JSX styles are objects
style="--main: red"style={{ '--main': 'red' }}custom properties keep their name
tabindextabIndexJSX uses camelCase attributes
readonlyreadOnlyJSX uses camelCase attributes
colspan="2"colSpan="2"JSX uses camelCase attributes
srcset="..."srcSet="..."JSX uses camelCase attributes
stroke-width="2"strokeWidth="2"SVG attributes are camelCased too
data-id / aria-labeldata-id / aria-labeldata-* and aria-* stay as-is
<br><br />JSX requires closed tags
<!-- note -->{/* note */}JSX comment syntax

How to Convert HTML to JSX

  1. 1Paste HTML copied from a template, design tool or web page
  2. 2The converter renames attributes and rewrites inline styles instantly
  3. 3Review the JSX output in the right-hand panel
  4. 4Copy it into a React component's return statement

Features

Reserved word renaming

class → className and for → htmlFor, since both are reserved in JavaScript.

camelCase attributes

Hyphenated HTML attributes like tabindex and colspan become tabIndex and colSpan.

Inline styles → objects

style="padding:4px" becomes style={{ padding: '4px' }}, with CSS custom properties preserved as string keys.

Self-closing void tags

<br>, <img>, <input> and other void elements are automatically self-closed.

SVG attribute support

Presentation attributes like stroke-width and fill-rule are camelCased for JSX-rendered SVG.

data-* and aria-* preserved

Accessibility and data attributes are left exactly as written — React accepts them unchanged.

Who Uses This

  • Frontend developersconvert markup exported from Figma, Webflow or another design tool into a React component.
  • Developers migrating jQuery-era sitesport existing HTML templates into JSX component by component.
  • Anyone pasting from Stack Overflowquickly convert an HTML snippet into valid JSX without manually renaming every attribute.
  • Email/marketing developersturn HTML email templates into reusable React components for a design system.

Frequently Asked Questions

JSX compiles to JavaScript, so attributes that collide with JS keywords (class, for) are renamed, all elements must be closed, and inline styles are objects rather than strings.

Yes. style="padding: 16px; border-radius: 8px" becomes style={{ padding: '16px', borderRadius: '8px' }} with CSS properties camelCased and CSS custom properties preserved.

Yes. Paste any HTML snippet — nested elements, SVG, forms — and copy the JSX to drop into a React component's return.

No. The conversion is pure client-side JavaScript, so nothing leaves your browser.

Yes. Common SVG presentation attributes — stroke-width, stroke-linecap, fill-rule, clip-path and others — are camelCased so pasted SVG icons work as JSX.

They're left exactly as-is. React accepts data-* and aria-* attributes in their original hyphenated form, so no renaming is needed or applied.

It's preserved as a quoted string key, for example style="--main-color: red" becomes style={{ '--main-color': 'red' }}, since custom properties can't be camelCased like standard CSS properties.

Related Tools