Lua Beautifier

Beautify, format, and clean up your Lua code instantly in a secure, client-side environment.

Input Lua
Output
Formatted output will appear here...
info

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.

star

Key Features

check_circle

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.

check_circle

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.

check_circle

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.

check_circle

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.

check_circle

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.

check_circle

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.

help

How to Use

01

Paste Your Lua Code

Copy your minified or messy Lua code and paste it into the input editor on the left.

02

Beautify or Minify

Click "Beautify" to format with proper indentation, or "Minify" to compress for production use.

03

Copy the Result

Use the copy button to grab your formatted Lua, or download it as a .lua file.

code_blocks

Example

A one-liner if/else block is expanded into readable multi-line code with consistent 2-space indentation for each nested scope.

Minified Lua input
local function greet(name) if name==nil then return "Hello, stranger!" else return "Hello, "..name.."!" end end print(greet("world"))
Beautified Lua output
local function greet(name)
  if name==nil then
    return "Hello, stranger!"
  else
    return "Hello, "..name.."!"
  end
end
print(greet("world"))
lightbulb

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.

quiz

Frequently Asked Questions

What is a Lua Beautifier? expand_more
A Lua Beautifier is a tool that takes minified, compressed, or poorly formatted Lua code and restructures it with consistent indentation, proper block alignment for functions, if/else blocks, and loops, making it easy to read and maintain.
Does this tool handle all Lua syntax? expand_more
Yes. The beautifier handles standard Lua constructs including functions, local functions, if/elseif/else blocks, for/while/repeat loops, table constructors, and nested blocks with proper indentation.
Is my Lua code secure? expand_more
Yes. All formatting is performed entirely in your browser using JavaScript. Your Lua code never leaves your machine and is not sent to any external server.
Can I customize the indentation? expand_more
Yes. Choose between 2 spaces (default), 4 spaces, or tab-based indentation using the selector in the toolbar before formatting.
Can I use this for Roblox Lua scripts? expand_more
Yes. The beautifier works with standard Lua syntax which covers Roblox Luau scripts, Love2D code, World of Warcraft addons, and any other Lua-based projects.
How is the Lua Beautifier different from the Lua Minifier? expand_more
They are opposites. The Lua Beautifier expands code by adding indentation and line breaks to make it readable — you use it when you need to understand or edit Lua source. The Lua Minifier strips whitespace and comments to produce the smallest possible output — you use it when deploying to a production environment or distributing a script where file size matters. Both operations are available on this page: Beautify to expand, Minify to compress.
Does beautifying change what the Lua code does? expand_more
No. The beautifier only adjusts whitespace and indentation. Lua ignores whitespace between tokens, so the formatted version runs identically to the original minified code.
Can I upload a .lua file instead of pasting? expand_more
Yes. Click the upload icon in the toolbar to select a .lua or .txt file from your computer. The formatted result can also be downloaded as a .lua file using the download button.