Pine Script Formatter
Free tool • No signup • Runs in your browser
Pine Script Formatter
Paste minified, unindented, or messy Pine Script (v4, v5, or v6) below. This tool cleans up indentation, spacing around operators, and blank lines — entirely on your device. Nothing you paste is uploaded or stored anywhere.
What this tool does
- Normalizes indentation to consistent 4-space blocks based on Pine Script's control structures (
if,for,while, function bodies,=>blocks) - Adds consistent spacing around operators and after commas
- Collapses excessive blank lines and trims trailing whitespace
- Works fully offline in your browser — your strategy code is never sent anywhere
Note: this is a formatter, not a compiler — it won't catch logic errors. Got an actual error message? Try the Error Explainer.