JSX to JavaScript Converter
Turn JSX into plain JavaScript in your browser. HTML-like tags become function calls, attributes become object properties, and you can choose classic createElement output or the newer automatic style.
How to Convert JSX to JavaScript
Quick answer: paste your JSX or open a file; the JavaScript appears below. Copy it or download the .js file.
-
1
Add your JSX
Paste it or open a file.
-
2
Choose options
Adjust the output on the right.
-
3
Check the JavaScript
Errors show the line number.
-
4
Copy or download
Save it as .js.
What You Get
What Is JSX?
JSX lets you write HTML-like tags inside JavaScript, mostly for building user interfaces with component libraries. A line such as <Button label="Save" /> is turned into a JavaScript function call before the browser runs it.
What Is JavaScript?
JavaScript is the programming language of the web. Every browser runs it, as do servers, build tools and many apps. Plain JavaScript output can be pasted into a script tag, a code playground, a simple project without build tools or any place that does not understand types or JSX.
Why Convert JSX to JavaScript?
Browsers cannot run JSX directly. Seeing the compiled JavaScript helps you understand what your components really do, debug odd behaviour, use a component on a page without a build setup, or answer questions about how tags, props and children are passed.
How the Conversion Works
Each tag becomes a call: lowercase tags such as div become strings, capitalised tags such as Counter stay as references to your components. Attributes become an object of props, curly-brace expressions are kept as code, and children are passed in order. Classic output uses React.createElement; automatic output imports small helper functions instead, as newer projects do.
Example
The counter sample becomes a function whose return statement is a createElement call for the div, containing a paragraph with the click count and a button whose onClick handler is kept exactly as written.
Tips
Use the same output style as your project: automatic for newer setups, createElement for older ones. Fragments written as empty tags are supported in both styles.
Who Uses It?
Front-end developers, students learning component libraries, and teachers explaining how JSX works. Because the code never leaves the device, it is also safe for private and client projects.
Step by Step
Paste your JSX into the input box, drop a file onto it, or press Open File. The JavaScript appears in the output box straight away and updates as you type, so you can fix errors and see the effect immediately. Adjust the options on the right. When it looks right, press Copy to put the result on your clipboard, or Download to save it as a .js file. Press Sample to see a worked example first.
Using Your JavaScript
Save the result as a .js file or paste it into a script, a code playground or the browser console. If the code still contains import statements, load it as a module or choose the require() option. Keep the original source as your master copy, because the types and tags make it easier to work on.
About the Output
Import and export statements are kept by default, which suits modern browsers and bundlers. Choose require() to get CommonJS output for older environments and some server setups. Comments and blank lines in your code are kept where possible, so the result stays readable. Line numbers in the output may differ slightly from the source because removed type declarations leave fewer lines.
Private, Free and Instant
The converter is free, with no sign-up and no limit beyond the 5 MB text size. Everything runs in your browser, so private source code, client projects and unreleased work are never uploaded or stored. It works on Windows, Mac, Linux and Chromebooks, and on tablets and phones.
What Happens When JSX Becomes JavaScript
JSX is the HTML-like syntax used by React. Browsers cannot run it directly. A compiler turns each tag into a function call that builds the element, so <h1 className="title">Hi</h1> becomes React.createElement("h1", { className: "title" }, "Hi").
What you can learn from the output
Seeing the plain JavaScript explains how components, props and children really work: attributes become an object, nested tags become extra arguments and curly braces simply insert JavaScript expressions. Fragments, spread attributes and conditional rendering all map to ordinary calls.
Cautions
- The output depends on the transform settings, such as classic createElement calls or the newer jsx runtime.
- A small snippet converts well; large projects need a proper build tool.
- Code is processed in your browser, so private code is not uploaded.
For typed code, see TSX to JavaScript.
Frequently Asked Questions
Questions about JSX to JavaScript