Transcode
Docs
InputHTML
OutputJavaScript

HTML to JSX

Convert HTML to Pug templates, JSX for React, or a JSON syntax tree.

Paste your input on the left and press Translate (or Ctrl/Cmd + Enter) to get the result on the right. Free, no sign-up.

Example

Input
<div class="card" id="profile">
    <img src="/avatar.png" alt="Avatar">
    <h2>Ada Lovelace</h2>
    <p>First <strong>programmer</strong>.</p>
    <a href="https://example.com" target="_blank">Website</a>
</div>

Frequently asked questions

Does the JSX output work in React?
Yes. Attributes such as class and for become className and htmlFor, and inline styles become objects. Review event handlers and custom attributes by hand.
Where does the conversion run?
HTML to Pug and HTML to JSX are processed on the server and are not stored. HTML to AST runs in your browser.