← All text tools

HTML to JSX converter

Turn HTML into React JSX: class to className, style objects and self-closing tags.

  • Free
  • No sign-up
  • Works on any device

About HTML to JSX converter

Paste HTML and get valid React JSX. The tool renames class to className and for to htmlFor, turns inline style strings into style objects, closes void tags like br and img, and converts attributes to camelCase. It saves the tedious edits when moving a static template into a component.

How to use HTML to JSX converter

  1. Paste your HTML snippet into the input box.
  2. Check the converted JSX with className, style objects and closed tags.
  3. Copy the JSX into your React component.

Why use this tool?

Also known as

Frequently asked questions

Why does React use className instead of class?

Class is a reserved word in JavaScript, and JSX is JavaScript, so React uses the DOM property name className for the HTML class attribute.

What else changes besides class?

Attributes like for become htmlFor, inline styles become objects, and tags such as img and input are self-closed. Event names also use camelCase.

Do I need to wrap the result in a parent element?

JSX must return one root element. If your HTML has several top-level elements, wrap them in a div or a fragment.

Is HTML to JSX converter free?

Yes. HTML to JSX converter on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

Can I put HTML to JSX converter on my own website?

Yes. Use the Embed on your site button under the tool to copy a short piece of code and paste it into your page. It is free, needs no account, and the tool keeps working inside your page.

Related tools