Lua Beautifier
Beautify, format, and clean up your Lua code instantly in a secure, client-side environment.
Formatted output will appear here...About Lua Beautifier
Lua Beautifier is a free online formatter that takes minified, compressed, or inconsistently indented Lua code and restructures it into clean, readable source. It inserts proper indentation for every block — functions, if/elseif/else chains, for and while loops, repeat/until constructs, and nested tables — so the logical structure of your code becomes immediately visible without changing a single character of runtime behavior.
You would reach for this tool when you receive a third-party Lua script that was minified for distribution, inherit a Roblox game script with no consistent style, or want to understand a World of Warcraft addon, Love2D game, or Nginx/Redis configuration snippet that was shipped as a single unreadable line. The indentation selector lets you choose between 2-space, 4-space, or tab-based formatting to match your project conventions. A built-in Minify button also lets you go in the opposite direction when you need to compress code for production.
All formatting is performed entirely inside your browser using JavaScript. Your Lua source never leaves your machine and is never sent to a remote server, so proprietary game logic, addon code, and confidential configuration files stay private. There are no usage limits, no file-size caps, no account required, and no cost.
Key Features
Block-aware indentation
Depth is tracked per Lua block keyword — function, if/then/else, for, while, repeat — so every nested scope is indented to the correct level rather than blindly adding spaces.
Configurable indent style
Choose 2 spaces (the Lua community default), 4 spaces, or hard tabs to match whatever convention your project or team already follows.
Built-in Minify mode
A single Minify button strips all comments and collapses whitespace so you can compress code for production from the same tool without switching tabs.
File upload and download
Upload a .lua or .txt file directly from disk and download the formatted result as a .lua file — no copy-paste required for large scripts.
100% client-side processing
Formatting runs in your browser. Your Lua source is never transmitted to a server, making it safe for proprietary game logic and confidential addon code.
Sample code for instant testing
Click the Sample button to load a realistic multi-function Lua snippet covering closures, loops, and table constructors so you can verify the output before pasting your own code.
How to Use
Paste Your Lua Code
Copy your minified or messy Lua code and paste it into the input editor on the left.
Beautify or Minify
Click "Beautify" to format with proper indentation, or "Minify" to compress for production use.
Copy the Result
Use the copy button to grab your formatted Lua, or download it as a .lua file.
Example
A one-liner if/else block is expanded into readable multi-line code with consistent 2-space indentation for each nested scope.
local function greet(name) if name==nil then return "Hello, stranger!" else return "Hello, "..name.."!" end end print(greet("world")) local function greet(name)
if name==nil then
return "Hello, stranger!"
else
return "Hello, "..name.."!"
end
end
print(greet("world"))
Common Use Cases
- arrow_circle_right
Deobfuscating Roblox and game scripts
Game scripts distributed through asset stores or public repositories are often minified to a single line. Beautifying them first makes it possible to audit the logic, spot bugs, and adapt the code to your own project.
- arrow_circle_right
Reading World of Warcraft and other addon code
WoW addon authors frequently ship tightly compressed Lua. Running the source through the beautifier restores readable indentation so you can understand event handlers, hook chains, and data tables without guessing the block structure.
- arrow_circle_right
Standardizing indentation across a team
When multiple contributors write Lua with different tab/space habits, paste each file through the beautifier with a shared indent setting to produce a consistent baseline before committing to version control.
- arrow_circle_right
Debugging Nginx and Redis Lua modules
Inline Lua blocks embedded in Nginx configs or Redis scripts are often written on one line to save space. Expanding them with the beautifier makes control flow and variable scope far easier to follow when tracking down a bug.
- arrow_circle_right
Learning Lua by reading formatted source
Students and newcomers can paste any Lua example they find online — however it was formatted — and get a cleanly indented version that makes the language structure (closures, metatables, coroutines) easier to study.