HTML → JSX Converter
Developer
Hand-rolled converter that rewrites the boring chores of porting HTML to a React component: attribute renames (`class`, `for`, `tabindex`, etc.), inline event-handler capitalization (`onclick → onClick`), self-closing of void tags (`<br>` → `<br />`), HTML comments to JSX comments, and optional conversion of `style="color: red; font-size: 14px"` to a `style={{ color: 'red', fontSize: '14px' }}` object literal.
<>
<div className="container">
<label htmlFor="email">Email</label>
<input type="email" id="email" required />
<button onClick="submit()" tabIndex="0" style={{ color: '#fff', backgroundColor: 'rebeccapurple', fontSize: '14px' }}>
Send
</button>
{/* footer */}
<p className="muted">By signing up you agree to our <a href="/terms">terms</a>.</p>
</div>
</>Quoted string attribute values stay as strings; if you need a JS expression instead, change it in the JSX after copying.
How to use
- Paste an HTML snippet.
- Toggle the wrap-in-fragment option if you want a single root for a React component.
- Copy the JSX into your component file.
Frequently asked questions
- What attributes get renamed?
- All the ones React renames: `class` / `for` / `tabindex` / `readonly` / `maxlength` / `contenteditable` / `spellcheck` / `autocomplete` / `autofocus` / `enctype` / `crossorigin` / `srcset` / `rowspan` / `colspan` / `usemap` / `datetime`, plus every `on…` event handler. `aria-` and `data-` attributes stay kebab-case.
- What if my inline style has CSS variables?
- Properties starting with `--` are quoted as string keys (`'--accent': 'blue'`) so they survive into the JSX. Vendor-prefixed properties like `-webkit-…` are also quoted.
- Does it run my JavaScript or eval scripts?
- No. The parser is a small hand-written scanner — `<script>` tags pass through as text just like any other element. The conversion is purely string-level.
Related tools
JWT Decoder
Decode a JSON Web Token to inspect its header, claims, and expiration.
UUID Generator
Generate random version-4 UUIDs in bulk, with copy.
Hash Generator (SHA)
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text.
URL Encoder / Decoder
Percent-encode text for URLs, or decode encoded URLs back to text.
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text, instantly.
JSON Formatter & Validator
Format, beautify, minify, and validate JSON right in your browser.