JSX
HTML

How to convert JSX to HTML

  1. Paste your JSX markup into the input field — a React component's return block, a JSX snippet, or output from a React-based generator.
  2. Click "Convert" — the standard HTML output appears instantly with className→class, htmlFor→for, and style objects converted to CSS strings.
  3. Switch to "HTML → JSX" using the toggle above if you need the reverse direction.
  4. Click "Copy" to copy the HTML to clipboard, or "Download .html" to save the file locally.
  5. Use the output in a static HTML page, email template, or any non-React HTML context.

How the JSX to HTML converter works

The converter applies the reverse of the JSX transformation rules: className is renamed back to class, htmlFor becomes for, camelCase event names are lowercased (onClick → onclick), self-closing JSX tags on void elements are normalized for HTML, and React style objects are serialized back to CSS strings. The conversion runs entirely in your browser — no data is sent to any server.

Not all JSX is directly convertible to HTML — JSX is a superset that includes JavaScript expressions, component references, and dynamic logic that have no HTML equivalent. The converter handles the structural and attribute-level differences and leaves JavaScript expression placeholders intact so you can see exactly what needs manual replacement.

Key transformations applied during JSX → HTML conversion
// Input JSX:
<div className="card" onClick={handleClick}>
  <label htmlFor="email">Email</label>
  <input type="email" id="email" readOnly tabIndex={1}
         style={{ border: '1px solid red', fontSize: '14px' }} />
  <br />
  <img src="avatar.png" alt="User" />
</div>

// Output HTML:
<div class="card" onclick="handleClick">
  <label for="email">Email</label>
  <input type="email" id="email" readonly tabindex="1"
         style="border: 1px solid red; font-size: 14px">
  <br>
  <img src="avatar.png" alt="User">
</div>

JSX attributes and their HTML equivalents

Each JSX-specific attribute name maps back to its original HTML counterpart. Custom data attributes (data-*) and ARIA attributes (aria-*) are kept unchanged — they are identical in both JSX and HTML.

JSX attributeHTML equivalentNotes
className="…"class="…"Reserved word conflict removed
htmlFor="…"for="…"Reserved word conflict removed
onClick={fn}onclick="fn"camelCase → lowercase; reference becomes string
onChange={fn}onchange="fn"All on* events lowercased
tabIndex={1}tabindex="1"camelCase → lowercase; value stringified
readOnlyreadonlycamelCase → lowercase boolean
maxLength={10}maxlength="10"camelCase → lowercase; value stringified
style={{ color: 'red' }}style="color: red"JS object → CSS string
style={{ fontSize: '14px' }}style="font-size: 14px"camelCase property → kebab-case
<br /><br>Self-closing slash removed for void elements
<img … /><img …>Self-closing slash removed
{/* comment */}<!-- comment -->JSX expression comment → HTML comment

When to convert JSX to HTML

Convert JSX to HTML when:

  • Sharing with non-React developers — designers or backend engineers who need the HTML structure without a React context.
  • Building email templates — email clients do not support React; JSX components need to be rendered to plain HTML first.
  • Generating static HTML output — extracting the HTML structure from a React component for static site generation preview.
  • Documentation examples — showing HTML usage for a component in docs, README files, or design system documentation.
  • Integrating with non-React systems — WordPress, legacy CMS platforms, or jQuery-based codebases that need standard HTML.

Keep JSX when:

  • Dynamic data is bound — {props.name}, {state.count}, and conditional rendering expressions must stay in JSX.
  • React events are needed — properly typed synthetic events and React's controlled component pattern require JSX.
  • Component composition is used — <Button variant="primary"> and other component references are not valid HTML.
  • The output will be rendered by React — if React renders the output anyway, converting to HTML and back is unnecessary.

Style objects: from React object back to CSS string

React style objects use camelCased property names and JavaScript values. Converting back to an HTML style string means reversing both transformations: camelCase property names become kebab-case CSS property names, and JavaScript values are serialized to strings. Unitless numeric values (zIndex: 10) become their string equivalents without units.

Style object to CSS string conversion
// React JSX style object:
style={{
  backgroundColor: '#fff',
  fontSize: '16px',
  marginTop: '8px',
  zIndex: 100,
  WebkitTransform: 'translateX(10px)',
}}

// Converted HTML inline style:
style="background-color: #fff; font-size: 16px; margin-top: 8px; z-index: 100; -webkit-transform: translateX(10px)"

// Rule: camelCase → kebab-case for all property names.
// PascalCase vendor prefixes (WebkitTransform) → -webkit-transform.

Limitations: what JSX to HTML cannot convert

JSX is a superset of HTML and includes JavaScript-specific constructs that have no HTML equivalent. The converter handles the attribute-level and structural differences, but the following patterns require manual handling after conversion:

  • JavaScript expressions — {variable}, {condition ? a : b}, {array.map(...)} are left as-is in the output. They need to be replaced with actual static values.
  • Component references — <Button />, <Header title="…" />, and other React component tags are not valid HTML. Replace them with the rendered HTML output of those components.
  • React-specific props — key, ref, and dangerouslySetInnerHTML are dropped or left as attributes; they have no HTML equivalent.
  • Fragments — <></> and <React.Fragment> have no HTML equivalent. The converter unwraps them, keeping only the children.
  • Conditional rendering — {isLoggedIn && <UserPanel />} expressions must be resolved to either the element or nothing by hand.

Frequently Asked Questions

What is the difference between JSX and HTML?
JSX (JavaScript XML) is a syntax extension for JavaScript used by React to describe UI structure. It looks like HTML but uses JavaScript naming conventions: camelCase attribute names (className, htmlFor, onClick), JavaScript objects for inline styles, and self-closing tags for all void elements. HTML uses lowercase attribute names (class, for, onclick), CSS strings for styles, and does not require self-closing tags on void elements. JSX compiles to JavaScript function calls; HTML is parsed directly by the browser.
Can I use the converted HTML directly in a browser?
Yes — the converted HTML is standard HTML5 that any browser renders. However, event handlers (onclick="handleClick") are converted as attribute strings, not as proper JavaScript function bindings. For interactive elements, you will need to wire up the JavaScript handlers after embedding the HTML.
What happens to React-specific props like key and ref?
key and ref are React-internal props that do not appear as HTML attributes — React processes them before rendering and they never reach the DOM. The converter drops them from the output. dangerouslySetInnerHTML is also dropped; if you need its inner HTML, extract the __html value and add it to the element content manually.
How are JSX expressions like {variable} handled?
JSX expressions are left in the output as-is with their curly brace syntax. They do not translate to HTML because they represent JavaScript values that are only resolved at runtime by React. You need to replace each {expression} with the actual rendered value by hand.
What happens to React component references like <Header /> or <Button>?
React component references are not valid HTML. They are left in the output unchanged — the converter has no way to know what HTML a component renders. You need to replace each component reference with its actual rendered HTML output. For programmatic conversion of full component trees, use React's ReactDOMServer.renderToStaticMarkup().
How are React style objects converted back to CSS?
camelCased property names are converted to kebab-case CSS property names (backgroundColor → background-color, marginTop → margin-top). JavaScript values are serialized to strings. Unitless numeric values (zIndex: 100) become their string equivalents (z-index: 100). PascalCase vendor prefixes (WebkitTransform) become hyphenated (-webkit-transform).
Does the converted HTML work in email clients?
The structural conversion is correct for email use — class, for, and standard HTML attributes are restored. However, React components, dynamic expressions, and JavaScript event handlers still need manual replacement. For fully email-ready HTML, also replace any style object syntax with inline CSS and remove all React-specific constructs.
What happens to self-closing JSX tags like <br /> and <img />?
Void elements (<br />, <hr />, <img />, <input />, <link />, <meta />) have the trailing slash removed: <br /> becomes <br>. Non-void elements that are self-closed in JSX (<div />) are expanded to open/close tag pairs: <div></div>.
Can I convert JSX fragments (<> </>) to HTML?
Yes. JSX fragments — both <> </> and <React.Fragment> </React.Fragment> — are transparent wrappers with no DOM output. The converter unwraps them, keeping only the children in the output. The fragment tags themselves are removed.
Is there a way to convert a full React component tree to HTML?
This converter handles markup-level JSX conversion — it processes the syntax, not the runtime rendering. To convert a full React component tree (including all nested components and dynamic data) to HTML, use React's server-side API: ReactDOMServer.renderToStaticMarkup() in Node.js, or renderToString() for hydration-ready output.
Is any data sent to a server during conversion?
No. The entire conversion runs in your browser using JavaScript string processing. No data is transmitted over the network — there are no file size limits, no rate limits, and no privacy concerns.