Shopify Liquid Formatter
Paste messy Liquid and get it re-indented and tidied up, right in your browser.
- Lines in
- 8
- Lines out
- 8
- {% %} tags
- 5
- {{ }} outputs
- 2
- Block tags open and close in a sane order
Formatted Liquid
{% if product.available %} <button>Add to cart</button> {% else %} <button disabled>Sold out</button> {% endif %} {%- for variant in product.variants -%} <option value="{{ variant.id }}">{{ variant.title }}</option> {%- endfor -%}
Re-indents code that's already broken into lines and tidies spacing inside {% %} and {{ }}. It won't merge, split or reflow lines, and it doesn't touch text inside {% comment %} or {% raw %}. For an exact match to Shopify's own style, run @shopify/prettier-plugin-liquid through the Shopify CLI or Prettier in your theme project.
What it fixes
This formatter re-indents Liquid that's already broken into lines (the way theme code is normally written, one tag or statement per line) and tidies the spacing inside every {% %} and {{ }}, collapsing extra spaces and lining up {% if %}, {% for %} and similar block tags with their matching {% endif %}, {% endfor %} and {% else %}.
It leaves {% comment %} and {% raw %} blocks untouched, since their contents aren't meant to be parsed as Liquid, and it doesn't merge or split lines, so a file that's all on one line stays on one line.
- Not a replacement for @shopify/prettier-plugin-liquid, Shopify's own formatter: this tool doesn't run it, since that needs an install this browser tool can't add
- For an exact match to Shopify's house style, run Prettier with that plugin through the Shopify CLI or in your theme's repo
- This tool is meant for a quick clean-up when you don't have that set up, or you're fixing a single pasted snippet
Using the result
Paste the formatted code back into Online Store → Themes → Edit code, or into your theme's repo if you use the Shopify CLI and GitHub integration. Always preview a change on a duplicate theme before publishing.
Questions people ask
Does this run Shopify's official Prettier plugin?
No. It's a lightweight formatter built for this tool that fixes indentation and tag spacing without needing an install. For byte-for-byte Prettier output, use @shopify/prettier-plugin-liquid through the Shopify CLI.
Will it change my Liquid's logic?
No, it only changes whitespace: indentation, blank lines and spacing inside tags. It never rewrites variables, filters or conditions.
Why didn't my one-line minified file get reformatted?
The formatter re-indents existing lines rather than deciding where to break new ones, since that's much easier to get right without breaking your code. Paste code that's already broken into lines for the best result.
Does it check for errors too?
It flags obviously unbalanced tags, but for the fuller set of Shopify's stricter-parser rules, use the Shopify Liquid validator.
Related tools
Last reviewed 30 September 2026.
