Code Beautifier (CSS, GraphQL, Shell)
Make minified or messy CSS, GraphQL and bash scripts readable in one click, with your choice of indentation, optional property sorting and a CSS minifier.
S'executa al teu navegador. Els fitxers mai no surten del dispositiu. Mira com comprovar-ho
…
Com es fa
- 1Choose the language
CSS, GraphQL or shell.
- 2Set the indent
Two spaces, four spaces or tabs.
- 3Paste code
Paste the snippet or file.
- 4Choose options
Sort properties or minify CSS.
- 5Check the result
Review the formatted code.
- 6Copy or download
Save the file.
Sobre aquesta eina
Code copied from a minified stylesheet, a one-line GraphQL query in a network log or a shell script edited by several people is hard to read and review. This beautifier lays it out cleanly. For CSS it puts each selector and declaration on its own line, normalises spacing after colons and commas, splits selector lists, handles nested at-rules such as media queries, and can sort properties alphabetically or minify the whole stylesheet instead. For GraphQL it formats queries, mutations, fragments and schema definitions with one field per line, readable arguments, variables and directives. For shell scripts it re-indents if, for, while and case blocks and functions while leaving heredoc bodies, strings and comments exactly as they are. Choose two spaces, four spaces or tabs, copy the result or download it.
CSS
- Each rule, selector and declaration on its own line, with consistent spacing. - Selector lists split one per line. - Media and supports blocks indented correctly. - Optional A to Z sorting of properties within each rule, which makes diffs and reviews easier. - Minify: removes comments (except /*! licence */ comments), whitespace and the last semicolon in each rule. Strings and comments are protected, so content strings with braces or URLs are never altered.
GraphQL
Operations, fragments and type definitions get one field per line inside braces, arguments stay on the field line with spaces after colons and commas, and comments starting with # are kept on their own lines. Spread operators (...), directives (@include) and variables ($id) are preserved.
Shell
Indentation follows the structure of if/then/elif/else/fi, for and while loops with do/done, case/esac with each pattern and its ;; terminator, and function bodies in braces. Heredocs (from the double less-than marker to the closing EOF word) are left untouched because their content must not change.
When formatting changes meaning
Formatting never changes CSS or GraphQL meaning. In shell, only indentation at the start of lines is changed, which does not affect execution, except inside heredocs and multi-line strings, which are preserved.
Why format before review
Consistent formatting makes diffs show real changes rather than whitespace noise, and makes long selectors, nested queries and shell conditions readable at a glance for every reviewer. Agree on one indentation style per project and format before committing.
Minify for production
Minified CSS is smaller to download. Keep the readable version in source control and minify as part of the build, or use the minify option for a quick one-off.
Limits
SCSS and Less nesting is indented but not compiled; one-line shell constructs with several keywords may need a manual touch. For full projects, configure Prettier or shfmt in your editor; this tool is for quick formatting of snippets and is not a linter.
Exemple resolt
A one-line query named GetUser that takes an $id variable and asks for the user's id and name becomes a six-line query with the user field and its id and name on separate, indented lines.
En resum
- Categoria: Desenvolupament i dades
- S'executa al navegador, sense registre, sense pujar res.
- La informació que introdueixes es queda al dispositiu.
- Disponible en anglès.
- Contingut revisat per última vegada:
- Font oficial: GraphQL specification (October 2021) and POSIX shell command language
Preguntes freqüents
Which languages are supported?
CSS (including flat SCSS and Less), GraphQL and shell scripts.
Will it change my code's behaviour?
No. Only whitespace and line breaks change; strings, comments and heredocs are kept.
Can it minify CSS?
Yes. Tick minify instead.
Can I sort CSS properties?
Yes, alphabetically within each rule.
Is my code uploaded?
No. Formatting runs in your browser.
Does it lint for errors?
No. Use a linter such as Stylelint or ShellCheck for that.
