Developer and Text Tools

How to Format Minified CSS, GraphQL Queries and Shell Scripts

Make minified CSS, one-line GraphQL queries and messy bash scripts readable: indentation, property sorting and when to minify, without changing meaning.

Saizul Amin
Saizul Amin30 Oct 2026 · 3 min read
How to Format Minified CSS, GraphQL Queries and Shell Scripts

How to Format Minified CSS, GraphQL Queries and Shell Scripts

Code is read far more often than it is written, and formatting is what makes it readable. Yet developers regularly face code with no formatting at all: a minified stylesheet from a production site, a GraphQL query copied from a browser's network tab as one long line, or a deployment script edited by five people with five indentation styles. The free CSS, GraphQL and Shell Beautifier lays out all three cleanly, with your choice of indentation.

CSS

Minified CSS removes every unnecessary character to save bytes. The beautifier reverses that: each selector starts a new block, each declaration sits on its own line, and spacing after colons and commas is made consistent. Selector lists are split one per line, so long groups of selectors are easy to scan. Media queries, supports rules and other nested at-rules are indented to show their structure.

Two options help with maintenance:

  • Sort properties A to Z within each rule. Sorted properties make duplicates obvious and keep diffs small when two people edit the same rule.
  • Minify does the opposite of beautifying, removing comments and whitespace and the final semicolon in each block, for a quick one-off production build. Comments starting with an exclamation mark, used for licence notices, are kept.

Strings and comments are protected during formatting, so a content value or a URL containing special characters is never altered.

GraphQL

GraphQL queries are often stored or logged on a single line. Formatted, a query reads like an outline: each field on its own line, nested selections indented under their parent, arguments kept next to their field with clean spacing. Fragments, mutations, subscriptions and schema type definitions all follow the same pattern. Comments, directives such as include and skip, spread operators and variables are preserved exactly.

A formatted query is much easier to review in a pull request, and easier to compare with the schema when a field returns null unexpectedly.

Shell scripts

Shell has no single official style, but consistent indentation makes control flow visible. The beautifier indents the bodies of if and elif blocks, for and while loops, case branches and functions, so you can see where each block ends. Heredoc bodies are left exactly as they are, because their content is data and changing whitespace inside them would change the output of the script. Strings and comments are not touched either.

Does formatting change behaviour?

For CSS and GraphQL, whitespace between tokens carries no meaning, so formatting is always safe. For shell scripts, the beautifier only changes indentation at the start of lines, which the shell ignores, and it protects the places where whitespace matters. Still, run your tests after reformatting any script that deploys or deletes things, as you would after any change.

Formatting in a team

Agree on one formatter configuration and run it automatically, for example in a pre-commit hook or in continuous integration. Then reviews focus on behaviour rather than spacing, and nobody has to argue about braces again.

Choosing an indentation style

Two spaces is common in web projects and GraphQL. Four spaces is popular in many shell style guides. Tabs let each developer choose their own display width. The best choice is the one your project already uses; the worst is mixing them. If your repository has an EditorConfig or Prettier setting, match it.

Step by step

  1. Choose the language: CSS, GraphQL or shell.
  2. Paste the code.
  3. Choose two spaces, four spaces or tabs.
  4. For CSS, decide whether to sort properties or minify.
  5. Copy the result or download it as a file.

Privacy

Formatting runs in your browser, so internal stylesheets, private API queries and scripts containing server names stay on your device.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages