Perl Beautifier
Paste compact Perl source and format it with proper indentation and consistent brace placement.
Last updated: May 29, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is Perl Beautifier?
Perl Beautifier reformats Perl source code — including packages, subroutines, conditionals, loops, and hash/array operations — so it is easy to read. Perl uses C-style curly braces and semicolons to delimit blocks, so the formatter applies the same brace-based indentation engine used for C, Java, and JavaScript. It handles single-line and block-comment styles, preserves string literals, and keeps $scalar, @array, and %hash sigils inline.
How to Use Perl Beautifier
Paste Perl source code.
Choose indentation style.
Click Format.
Review the beautified output.
Copy or download the .pl file.
Common Use Cases
- Expanding compact Perl scripts inherited from legacy codebases.
- Normalizing indentation when merging Perl snippets from different authors.
- Formatting Perl examples before adding to documentation or wikis.
- Tidying minified Perl one-liners expanded to multi-line form.
Example Input and Output
A compact Perl subroutine is expanded with proper indentation.
sub greet{my($name)=@_;if($name){print "Hello, $name\n";}else{print "Hello!\n";}}sub greet {
my ($name) = @_;
if ($name) {
print "Hello, $name\n";
} else {
print "Hello!\n";
}
}Privacy
Perl code is formatted locally in the browser and is not uploaded.

