HTML to JSX

Convert HTML into React JSX. Paste markup and get JSX with class turned into className, for into htmlFor, inline style strings into style objects, void tags self-closed, comments wrapped in braces and event handlers converted — plus notes on anything you should check, like form fields that became uncontrolled. Optionally wrap the result in a component. It's free, runs in your browser, and nothing is uploaded.

Common renames

HTMLJSX
classclassName
forhtmlFor
tabindextabIndex
style="color: red"style={{ color: "red" }}
<br><br />
<!-- note -->{/* note */}
onclickonClick

When to use it

  1. Move a static HTML template or landing page into React.
  2. Convert a snippet from documentation or a UI kit into a component.
  3. Port Bootstrap or Tailwind examples into JSX.
  4. Fix the style and className errors from pasting HTML into a component.

How to Use

  1. Paste your HTML.
  2. Optionally wrap it in a named component.
  3. Copy the JSX and review the notes.

Features

  1. Browser-accurate HTML parsing
  2. 70+ attribute renames
  3. Style strings to objects
  4. Boolean and void element handling
  5. Fragment for multiple roots
  6. Conversion notes
  7. 100% client-side

FAQs

What changes when HTML becomes JSX?

Attribute names (className, htmlFor, tabIndex), style strings to objects, self-closing void tags, comments in braces, and one root element per component.

How are inline styles converted?

style="margin-top: 4px" becomes style={{ marginTop: "4px" }}, with vendor prefixes and custom properties handled.

Why did value become defaultValue?

In React, value without onChange makes a read-only field. defaultValue keeps it editable; switch back if you want a controlled input.

What about onclick attributes?

They become arrow functions, but check them: React passes its own event object and the code may rely on this.

Is my HTML uploaded?

No. It's parsed and converted in your browser, and scripts in it are never run.

Technical Details

The HTML is parsed by the browser's own HTML parser inside a template element, which handles everything real-world markup throws at it — unclosed paragraphs, unquoted attributes, void elements like br and img — exactly as a browser would, and never runs scripts or loads images. The resulting tree is written out as JSX. Attributes are renamed to React's names: class to className, for to htmlFor, tabindex to tabIndex and about seventy others, while data- and aria- attributes stay as they are. Boolean attributes become bare props. Inline style strings become style objects with camelCased properties, vendor prefixes in React's form (WebkitLineClamp), custom properties quoted and unitless numbers left as numbers. On form fields, value and checked become defaultValue and defaultChecked so the fields stay editable. Inline event handlers become arrow functions, comments become {/* */}, braces and angle brackets in text are escaped, and several top-level elements are wrapped in a fragment. Anything that needs a human decision is listed as a note.

Developer Tools

Developer Tools

  • SVG to JSX Converter
  • Data URI Generator & Decoder
  • SVG to CSS Converter
  • CSS Data URI Converter
  • Basic Auth Header Generator
  • Hex Dump Viewer
  • Text Encoding Inspector
  • Punycode Converter