Omnikit
DevFilesMoneyAll tools
Ctrl K
Dev toolsFile toolsMoney calculatorsAll tools
HomeDeveloper toolsHTML to JSX Converter

HTML to JSX Converter

dev

Paste HTML and get JSX React accepts: className, style objects, closed tags, camelCase

Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 22 Oct 2026.

JSX looks like HTML with about 5 rules changed: class becomes className, for becomes htmlFor, style becomes an object such as style={{ fontSize: '12px' }}, every tag must be closed (<br />), and attributes are camelCase, such as tabIndex and strokeWidth. Paste HTML here and all of it is done for you.

Next:
  • HTML Formatter & Minifier Indent messy HTML, or minify it and see the bytes you saved
  • JavaScript Beautifier & Minifier Beautify JavaScript, or minify it and see how many bytes went

How to convert HTML to JSX

1

Paste the HTML, or open an .html or .svg file; nothing is uploaded.

2

Read the JSX on the right: className, htmlFor, style objects and closed tags are already done.

3

Type a component name to wrap it in a function, and tick Pass props for an icon component.

4

Read the notes under the result, such as removed onclick handlers, then copy.

About HTML to JSX Converter

Copying a snippet from a template, a design tool or an old page into a React component usually ends in a screen of warnings. This converter rewrites the markup into JSX that compiles and renders the same thing.

What changes.

HTML JSX
class="card" className="card"
for="email" htmlFor="email"
style="font-size: 12px" style={{ fontSize: '12px' }}

, <img ...>

, <img ... />
tabindex, maxlength, srcset tabIndex, maxLength, srcSet
stroke-width, xlink:href strokeWidth, xlinkHref
{/* note */}
{ and } in text {'{'} and {'}'}

Forms stay editable. A value or checked attribute in JSX locks a field unless you add an onChange handler. The converter writes defaultValue and defaultChecked instead, moves selected options to the select's defaultValue and turns textarea content into defaultValue, so fields work straight away. Turn this off if you will wire up state yourself.

Markup is read like a browser reads it. Missing end tags for li, p, td and option are closed where the HTML Standard says they end, rows placed directly in a table get a tbody, and white space between inline elements on different lines is kept as {' '} so words do not run together.

SVG. Attributes and tags get the case React expects, such as viewBox and linearGradient, the XML header and editor data from Inkscape or Illustrator are removed, and Pass props makes an icon component you can size from outside.

Notes. Inline handlers such as onclick are removed and listed, since JSX needs a function, not a string. Every example in the tests is compiled by TypeScript and rendered by React 19 with no warnings. Nothing is uploaded. Related tools: HTML Formatter, SVG Optimizer, JSON to TypeScript.

Frequently asked questions

Why does React say Invalid DOM property class?

JSX compiles to JavaScript, where class is a reserved word, so React uses the DOM property name className instead. The same applies to for, which becomes htmlFor. Paste your markup above and every class and for attribute is renamed, along with tabindex, maxlength and the other camelCase names.

How do I convert an inline style to a React style object?

Each CSS declaration becomes a key and a string value inside double braces, with hyphenated names in camelCase: style="font-size: 12px" becomes style={{ fontSize: '12px' }}. Vendor prefixes start with a capital, such as WebkitTransition, and custom properties such as --gap keep their quoted name.

Can I convert an SVG file into a React component?

Yes. Open the .svg file or paste its code, type a component name and tick Pass props. The result is a function component with {...props} on the svg element, so width, height, className and colour can be set wherever it is used. Attribute names are converted to the case React expects.

What happens to onclick and other inline handlers?

Handlers written as strings, such as onclick="save()", cannot work in JSX, which needs a function. The converter removes them and lists each one under the result, so you can add onClick={save} or the right handler yourself without a silent bug.

Why do value and checked become defaultValue and defaultChecked?

In React, a field with value but no onChange handler is read-only: typing does nothing. The defaultValue and defaultChecked props set the starting value and leave the field editable, which matches how the HTML behaved. Turn off Uncontrolled forms to keep value and checked for state you manage yourself.

Is my HTML sent anywhere?

No. The conversion runs in your browser as you type, and nothing you paste or open is uploaded or stored. Markup is read by a small parser in the page, so even a large template converts in a moment and works offline once the page has loaded.

Sources

  • React, Common components (e.g. <div>)className, htmlFor, style as an object with camelCase names; data-* and aria-* stay as in HTML
  • React, <input>defaultValue and defaultChecked for uncontrolled fields; value without onChange makes a read-only field
  • WHATWG HTML Standard, 13.1 Writing HTML documentsVoid elements and the end tags that may be left out (li, p, td, tr, option)

Last verified 22 October 2026.

Rates and rules change; check the source before you rely on a figure.

Still stuck? Ask about HTML to JSX Converter and anybody who knows can answer. No account needed.

Common uses

  • SVG to JSX ConverterTurn an SVG file into JSX or a React icon component, with camelCase attributes

On the related tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · Query String Parser – Split a URL query string into a table of decoded parameters.

Related tools

All developer tools
Base64 Encode & DecodeText and files to Base64 and back, with URL-safe mode and image previewUnix Timestamp ConverterUnix timestamps to dates and dates to timestamps, in any time zoneJSON to TypeScriptGenerate TypeScript interfaces or types from a JSON sampleCSV to JSONConvert CSV to JSON and JSON to CSV, with a table previewYAML to JSONConvert YAML to JSON and JSON to YAML, with anchors resolvedURL Encoder / DecoderPercent-encode or decode text and URLs, and see every part of a linkColor ConverterHEX, RGB, HSL, HWB, OKLCH and CMYK in both directions, with a contrast checkNumber Base ConverterBinary, octal, decimal, hex and any base to 36, exact at any size, with two's complement
Was this tool helpful?
Omnikit

Small jobs, done in your browser. Free, fast and private. Files are never uploaded.

Files

  • Compress Image
  • Image to PDF
  • Merge PDF
  • Compress PDF
  • PDF to Word
  • Word to PDF

Dev

  • JSON Formatter & Validator
  • Base64 Encode & Decode
  • JWT Decoder, Verifier & Encoder
  • Password Generator
  • UUID Generator
  • Unix Timestamp Converter

Money

  • SIP Calculator
  • EMI Calculator
  • GST Calculator
  • FD Calculator
  • PPF Calculator
  • Lumpsum Calculator
GuidesQuestionsAboutHow we checkLaw library (beta)PrivacyTermsDisclosureContactMore: Exam practice (UGC NET Paper 1)Runs in your browser. Nothing is uploaded. © 2026 Omnikit (theomnikit.com)