Canonical: https://toolipedia.app/minifier-for-graphql-json5-and-template-languages

# Minifier for GraphQL, JSON5 and Template Languages

Minify GraphQL, JSON5, Handlebars, Mustache, Jinja and Twig text by removing comments and extra whitespace while keeping strings exactly as written.

Breadcrumbs: Toolipedia > Developer tools > Code and developer utilities > Minifier for GraphQL, JSON5 and Template Languages

## About Minifier for GraphQL, JSON5 and Template Languages

The usual minifiers handle CSS, JavaScript, HTML and JSON, but not these formats. This one removes comments and extra whitespace from GraphQL queries and schemas, JSON5 and JSONC configuration, Handlebars and Mustache templates, and Jinja, Twig and Nunjucks templates, always leaving string contents untouched. GraphQL commas, which the language ignores, can be dropped too, and trailing commas in JSON5 can be removed. Example: a GraphQL query with a comment and indentation shrinks to query GetUser($id:ID!){user(id:$id){name email}} while a space stays between the two names.

## How to use Minifier for GraphQL, JSON5 and Template Languages
1. Choose the language and paste your code.
2. Set the options, for example removing commas or spaces between tags.
3. Copy the minified text or download it, and compare the sizes shown.

## Why use this tool?
- Private: everything happens in your browser. Nothing you enter is uploaded.
- Free, with no sign-up, no watermark and no limit on how often you use it.
- Works on phones, tablets and computers: Android, iPhone, Windows, Mac and Linux. Nothing to install.

## Also known as
- minifier for graphql json5 and template languages
- graphql minifier
- json5 minifier
- handlebars minifier
- jinja template minifier
- remove comments from graphql

## Frequently asked questions

### Is the minified GraphQL still valid?

Yes. Whitespace is kept only where two names or numbers would otherwise merge, strings and block strings are kept exactly, and commas are optional in GraphQL.

### Why can minifying a template change how a page looks?

Whitespace between inline HTML elements is shown as a space in the browser. Collapsing runs of whitespace is safe in most places, but removing spaces between tags can join words, so that option is off by default.

### Does the JSON5 minifier produce strict JSON?

No. It keeps unquoted keys, single quotes and similar JSON5 features. Use a JSON5 to JSON converter first if a strict JSON parser has to read the result.

### Is Minifier for GraphQL, JSON5 and Template Languages free?

Yes. Minifier for GraphQL, JSON5 and Template Languages on Toolipedia is free to use, with no sign-up and no watermark.

### Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

### Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

### Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

## Related tools

More free tools that go well with Minifier for GraphQL, JSON5 and Template Languages:
- [HTML Minifier](https://toolipedia.app/html-minifier)
- [Code Formatter and Syntax Validator for Many Languages](https://toolipedia.app/code-formatter-and-syntax-validator-for-many)
- [SQL minifier](https://toolipedia.app/sql-minifier)
- [XML Minifier](https://toolipedia.app/xml-minifier)
- [Esoteric Language Interpreter](https://toolipedia.app/esoteric-language-interpreter)
