How to run JavaScript online
Try a snippet quickly without opening developer tools. Output from console.log, warn and error appears below the editor.
Open the JavaScript Editor tool
Step by step
- Write your code. Type or paste JavaScript. Add HTML if you need elements.
- Press Run. Or press Ctrl+Enter. Output appears in the console box.
- Copy or download. Copy the code or save it as a file.
Tips for better results
- Press Run to execute; the code does not run while you type.
- Add HTML to test DOM code. Scripts see the HTML you provide.
- Avoid endless loops; they can freeze this tab.
Limits to know
- Formats: JavaScript and HTML
- Size: Limited by browser memory
- Notes: Runs in a sandboxed frame. An endless loop can freeze the tab; close or reload the page if that happens.
At a glance
| Tool | JavaScript Editor |
|---|---|
| Category | Developer Tools |
| Works with | JavaScript and HTML |
| Size limit | Limited by browser memory |
| Where it runs | In your browser tab; your input is not uploaded |
| Cost | Free, no sign-up |
Frequently asked questions
Where does the code run?
In an isolated, sandboxed frame inside your browser. It cannot read this site, cookies or your files.
Can I use fetch?
Network requests from the frame are limited by the browser sandbox and may fail.
If something does not work
- The result is empty. Check that you typed or pasted text into the input box and that the options are not hiding everything.
- The page feels slow. Very large text slows any browser tool. Work on smaller parts.
- Characters look wrong. Make sure the text is saved as UTF-8 in the program you copied it from.
- Copy does not work. Some browsers block automatic copying; select the result and copy it yourself.
Still stuck? Use Report a Problem and tell us the tool, your browser and what happened, or read the Help Center.
Related tools and guides
- JSON Formatter: Format, indent, sort and minify JSON. Invalid JSON is reported with the line and column of the problem. Read the guide
- JSON Validator: Check whether your JSON is valid. If it is not, see the exact line and column and a plain-English reason. Read the guide
- HTML Formatter: Indent and tidy HTML. Inline tags stay on the line, and embedded CSS and JavaScript are formatted too. Read the guide
More tools like this are in Developer Tools, or browse all tools.