Skip to content
JSON & DATA TOOLS

JSON Minifier – Compress JSON Online

Remove unnecessary whitespace from valid JSON.

  • Free
  • No signup
  • Runs in your browser

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

JSON Minifier

About JSON Minifier

A JSON minifier removes every optional space, tab and line break so the same data takes fewer bytes. This tool parses your JSON first and then writes it back in its most compact form, which means invalid input is reported as an error instead of producing broken output.

Smaller JSON helps when you embed data in a page, store it in a database column, send it in a request body or keep a configuration file under a size limit. The structure and values stay the same.

How to use JSON Minifier

  1. Paste formatted JSON into the input box.
  2. Click Run Tool. The compact one-line result appears in the output box.
  3. Copy it, or download it as a text file for use in your project.

Example

Input

{
  "site": "nhplearning.com",
  "tools": [
    "json",
    "regex"
  ],
  "active": true
}

Output

{"site":"nhplearning.com","tools":["json","regex"],"active":true}

Common uses

  • Reducing the size of JSON that is embedded in an HTML page or script tag.
  • Preparing a compact request body for an API call or webhook test.
  • Storing JSON in a database field or a WordPress option where whitespace is wasted space.

Privacy and safety

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

Frequently asked questions

Does minifying change my data?

No. Only whitespace outside string values is removed. Keys, values and nesting are unchanged.

Will it remove comments?

JSON does not allow comments, so JSON with comments is rejected as invalid. Remove them first, or use the Remove Code Comments tool on the text before pasting.

How much smaller will the file be?

It depends on how much indentation the original has. Pretty-printed JSON usually shrinks noticeably, while JSON that is already compact will not change.

Learn to build this yourself

Free tutorials and courses on NHP Learning cover PHP, JavaScript, SQL and WordPress, from the basics to real projects.