Neatbo.

JavaScript formatter

Make JavaScript easier to read with consistent indentation, spacing and line breaks.

Browser-local processingInputJavaScriptOutputFormatted JavaScript textUp to 10 MiB per file · File limit: 1
  1. 1Add input
  2. 2Adjust settings
  3. 3Get your result

Tool input and files are processed in this browser without being uploaded.

Your input

or drag and drop it here

Files stay on this device. Your originals stay unchanged.

.js · .mjs · .txt

Up to 10 MiB per file · File limit: 1

    0 characters · 0 bytes
    Options

    Complete the required options first. You can keep the defaults for the rest.

    Inputs are kept temporarily in this tab when switching tools. Refreshing or closing clears them; large results may need to be regenerated.⌘ / Ctrl + Enter to run

    Preparing the tool…

    Before you start

    Format pasted JavaScript or one local file with Prettier. Choose two- or four-space indentation and a quote preference; the code is processed in your browser without being run.

    How to use this tool

    1. Paste code into “JavaScript” or choose one UTF-8 file. Clear the text box to use the file, or remove the file to work with pasted code alone.
    2. Under “Options”, choose 2 or 4 spaces for “Indentation” and set “Quote preference”. Then select “Format JavaScript”.
    3. Review the formatted code. Use “Copy result” to copy it or “Download” to save formatted.js. Run the formatter again if you change the input or options.

    Supported inputs and limits

    Paste up to 1 MiB of UTF-8 text, or choose one UTF-8 file up to 10 MiB. The file picker accepts .js, .mjs and .txt files. Filenames can contain up to 512 UTF-16 code units; one visible character may use more than one code unit. Pasted text takes priority whenever the box is nonempty, even if it contains only spaces. A selected file is still checked and read.

    Worked example

    Example input

    const x={a:1,b:"text"};
    Example options
    {}

    Example output

    const x = { a: 1, b: "text" };
    

    When something does not work

    Check the JavaScript syntax and indentation, then select “Format JavaScript” to retry. If a file will not format, save it as UTF-8 in another application and select it again, or remove it and paste the code. Shorten an overlong filename or reduce input that exceeds the size limits. After changing input or cancelling, run the formatter again before using the result.

    Frequently asked questions

    Are my files uploaded?

    No. Formatting happens in your browser. A workspace can remain in memory when you visit other tools in the same tab, but it has size and time limits and may be removed. Refreshing or closing the tab clears it. Save any results you need.

    What does successful formatting tell me?

    Prettier could parse and format the input; you still need to check how the program behaves. Formatting does not compile TypeScript, minify code or restore original variable names from minified code. The quote setting is a preference: Prettier may use the other quote style to avoid extra escaping. JSX attribute quotes follow separate rules and are not controlled by this setting.

    Documentation & further reading

    Related tools