# JavaScript Formatter > Free in-browser JavaScript formatter, minifier and syntax checker. Format messy or minified JavaScript with 2 or 4 spaces or a tab, minify it with byte savings, and check the syntax with line numbers and ASI warnings. No signup, no upload, code never runs. - [JavaScript Formatter](https://lab.awaara.cn/javascript-formatter/): format messy or minified JavaScript with 2 spaces, 4 spaces or a tab, or minify it for production. The syntax check parses the code without running it, reports the exact line and column of each error, and warns about ASI hazards (a line starting with (, [ or a backtick, and return on its own line). Free, runs in your browser. ## Features - Format: re-indent JavaScript with 2 spaces, 4 spaces or a tab; short objects and arrays stay on one line when they fit in 80 characters, longer ones break to one member per line - Minify: strip comments, collapse whitespace, drop the semicolon before a closing brace and at the end of the file; reports bytes before and after, percent saved, and a gzip estimate - Validate: parse-only syntax check with new Function (code is never run), error line estimated by testing shorter prefixes; import and export files skip the check with a clear note - Warnings: ASI hazards (lines starting with (, [ or a backtick that join the line above, return on its own line returning nothing) - Tokenizer: strings, template literals, regexes and comments kept exactly as written; regex vs division decided by what came before the slash; JSX and TypeScript annotations are not supported - Samples: minified checkout function and messy checkout function, one click to load - File upload for .js, .mjs and .txt, up to 500,000 characters ## Limits - Semicolons are never added by formatting, and never removed except the redundant one before } in Minify mode. - Template literals come back exactly as written, including the expressions inside ${...}: the formatter does not re-indent code inside a template. - JSX is not supported: a div tag reads as comparisons. TypeScript annotations such as x: string read as labels. Use Prettier for those. - The syntax check answers one question only: does this parse. Type errors and run-time errors are not caught. - Minify adds a semicolon only after return, throw, break or continue on its own line, to keep the meaning the same. ## Use it - Web: https://lab.awaara.cn/javascript-formatter/ - Paste JavaScript, pick an indent and an output mode, press Format. Or press Validate only to check without changing the input. ## Source - Prettier documentation: https://prettier.io/docs/ - MDN, JavaScript Guide: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide - MDN, Function constructor: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function - js-beautify on GitHub: https://github.com/beautifier/js-beautify - Terser on GitHub: https://github.com/terser/terser