JSON Minifier

Paste your JSON below to strip all unnecessary whitespace and get a compact version instantly. Invalid JSON is flagged with an exact error message. All processing is client-side — your data never leaves your browser.

Strip comments
Sort keys
Validate only
Input · JSON
Output · Minified
❤️ Support CodeConverter.net and donate ❤️

Why minify JSON?

What does JSON minification do?

JSON minification removes all whitespace — spaces, tabs, and newlines — that sits between tokens in a JSON document. Because JSON's grammar assigns no semantic meaning to whitespace outside of string values, a minified JSON document is 100% functionally identical to its pretty-printed counterpart. Every parser, every language runtime, and every API will consume it exactly the same way.

The payoff is purely in payload size. Pretty-printed JSON from APIs and config generators can contain thousands of characters of indentation in a large document. Minification typically achieves 10–30% size reduction on its own; combined with Gzip or Brotli compression at the transport layer, the savings compound further. For REST APIs, webhooks, and data pipelines that transfer JSON millions of times per day, this adds up to real bandwidth and latency improvements.

Smaller API payloads
  • Compact JSON transfers faster over the network
  • Reduces memory allocation during parsing
  • Lower storage cost for cached or archived JSON
  • Faster serialization & deserialization in tight loops
100% private & client-side
  • Parsed entirely by the browser's built-in JSON.parse
  • Zero data transmitted to any server
  • Safe for API credentials, config files, and private data
  • Works offline — no internet required after load
How to use this tool
  • Paste your JSON or click Upload to load a file
  • Toggle options (strip comments, sort keys, validate only)
  • Click Minify JSON to process
  • Copy the result or download as .min.json
Extra options explained
  • Strip comments — removes // … and /* … */ from JSONC files
  • Sort keys — object keys sorted A→Z for deterministic output
  • Validate only — checks JSON validity without modifying output
  • Syntax errors are reported with position info

JSONC and JSON with comments — what's the difference?

Standard JSON (as defined by RFC 8259) does not allow comments. However, a widely-used superset called JSONC (JSON with Comments) — popularised by VS Code configuration files like tsconfig.json, launch.json, and settings.json — adds support for single-line (// …) and multi-line (/* … */) comments. JSONC files are not valid JSON and will cause a parse error in any standard JSON.parse call.

This tool's "Strip comments" option pre-processes input by removing both comment styles before parsing, allowing you to safely minify JSONC files. The resulting output is always valid, spec-compliant JSON. If you work with TypeScript, Vite, or any tool that uses JSONC config files, enabling this option before minifying will prevent parse errors downstream.