We use cookies.This website uses essential cookies to operate core features. With your consent, we also use analytics cookies to understand traffic and improve the service. For more details, see our .
Was this tool helpful to use?
Your feedback helps us make it better
Free online Perl code formatter and beautifier. Automatically indent and align your scripts to output clean, standardized, and readable Perl code.
Overview
Understand what the tool solves, how it works, and the boundaries of its data.
Paste Perl source to rearrange its layout into a more readable form or make its whitespace more compact. The result is text for you to review; the tool does not compile, execute, lint, or repair the program. In Beautify mode, choose 2, 4, or 8 spaces, tabs, and either K&R braces (opening brace on the same line) or Allman braces (opening brace on a new line). You can also remove comments in this mode. Minify mode compresses formatting whitespace and removes comments automatically.
Perl is often described as free-form because whitespace mostly separates tokens. That does not mean every whitespace change is harmless: heredoc delimiters, quoted text, regular expressions, and other constructs have their own parsing rules. Treat formatting as a proposed layout change, then inspect the resulting diff and test it with the Perl version used by your project.
Guide
Follow the workflow and verify inputs and outputs with practical examples.
Enter or paste the source in the Perl Code pane. Keep your original file available so you can compare the output before replacing anything.
Select Beautify to set indentation and brace style. Select Minify when you want a compact text layout; that mode removes comments automatically.
Choose 2, 4, or 8 spaces, or use tabs. Pick K&R or Allman brace placement. Turn on Remove Comments only if you intend to discard comments and embedded POD documentation.
Read the Formatted Output, compare it with your source, and check strings, regular expressions, heredocs, comments, and block boundaries. Copy the text or download it as formatted.pl after review.
For example, compact code such as if ($ready) { print "go"; } may be laid out with the conditional and print statement on separate lines. The precise result depends on the selected brace and indentation settings.
Use cases
See how the tool fits into real work and everyday tasks.
If a small Perl change is hard to scan because its blocks are crowded together, apply the style your team already uses, then inspect the diff. Consistent indentation can make control flow easier to review, while the diff confirms what text moved.
For a pasted example or legacy fragment, Beautify can expand visible block structure for a first pass. Keep the result as a reading aid until you have checked special syntax and tested the code.
Minify can produce a more compact text version when that is useful for inspection or transfer. Since comments are removed in this mode, do not use its output as a documentation-preserving replacement for the source.
Q&A
Find concise answers to common questions and confusing cases.
No formatter can guarantee that from layout alone. Perl's whitespace usually separates tokens, but special syntax has its own rules. Compare the source and result, then run your normal syntax checks and tests.
In Beautify mode, leave Remove Comments off. Minify mode removes comments automatically, so use Beautify when comments or POD documentation must remain in the output.
A heredoc's terminating marker and, for indented forms, the indentation around that marker and its body have defined behavior. Check the whole heredoc after formatting, especially its terminator and leading whitespace.
Notes
Review scope, result limitations, and important precautions before use.
This is a text-layout aid, not a Perl parser, compiler, or syntax checker. It can return output without proving that the input is valid or that the result preserves behavior. Carefully inspect heredocs, quoted strings, regular expressions, POD, comments, and any code where spaces or line breaks may matter. Removing comments also removes explanatory text; minify mode does this automatically.
Keep a backup, compare the source and formatted output, and run project checks in the target Perl environment before using the result. The character and line counts describe the text only; they do not measure correctness, execution speed, or code quality.
Related
Discover related tools, collections, and available API capabilities.