Lua Beautifier - Free Online Lua Code Formatter
Beautify and format Lua code online for free. Auto-indent, clean up whitespace, and make your Lua scripts readable.
What is Lua Beautifier?
How to Use Lua Beautifier
Paste your Lua code into the input field. Click "Beautify" to automatically format it with proper indentation for if/else, function, for, while, and repeat blocks. Nested blocks are indented consistently, making the code structure immediately visible. Copy the beautified code from the output area with one click.
How Lua Beautifier Works
Common Use Cases
- Formatting Roblox Lua scripts for readability and collaboration
- Cleaning up minified or obfuscated Lua code for analysis
- Beautifying Neovim configuration files (init.lua, plugin configs)
- Making Lua game mods (World of Warcraft, Garry's Mod) readable for editing
- Formatting OpenResty/Nginx Lua scripts for code reviews
- Standardizing code style before committing Lua projects to version control
Frequently Asked Questions
What Lua constructs does this beautifier handle?▼
It handles all standard Lua constructs including functions, if/elseif/else blocks, for loops (both numeric and generic), while loops, repeat/until loops, and arbitrarily nested blocks with proper indentation.
Can I customize the indentation?▼
The default indentation is 2 spaces per level, which is the most common convention in Lua projects. This consistent style works well for most codebases including Roblox, Neovim, and game development.
Does it work with Roblox Luau?▼
Yes, the beautifier handles standard Lua syntax which is the foundation of Roblox Luau. Basic Luau features like type annotations are preserved, though advanced Luau-specific syntax may be treated as regular code.
Will it modify my string contents?▼
No. The beautifier only changes whitespace and indentation outside of string literals. All your string contents, including multi-line strings delimited by [[...]], are preserved exactly as written.
Can it format minified Lua code?▼
Yes. The beautifier can take single-line, minified Lua code and expand it into properly indented, readable format. This is useful for analyzing compressed scripts or game mods.
Does it handle comments?▼
Yes. Both single-line comments (--) and multi-line comments (--[[...]]) are preserved in their relative positions within the code.