WebToolsPlanet
Developer Tools

Lua Beautifier

Paste compact Lua source and indent it based on Lua block keywords like do, then, function, and end.

Last updated: May 29, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is Lua Beautifier?

Lua Beautifier formats Lua snippets so functions, loops, conditionals, and table constructors are easy to read. Because Lua uses keywords such as do, then, function, repeat, and end to delimit blocks instead of braces, the formatter indents based on those keywords and on table braces. It is intentionally lightweight and focuses on indentation and line breaks rather than parsing or rewriting the program.

How to Use Lua Beautifier

1

Paste Lua source code.

2

Choose indentation style.

3

Click Format.

4

Review the beautified Lua output.

5

Copy or download the .lua file.

Common Use Cases

  • Cleaning Lua examples before adding them to a game mod or config.
  • Reading compact code copied from a forum or gist.
  • Indenting Neovim or Roblox Lua snippets for review.
  • Preparing Lua samples for documentation or screenshots.

Example Input and Output

A one-line Lua function is expanded with block indentation.

Compact Lua
function greet(name) if name then print("Hi "..name) end end
Beautified Lua
function greet(name)
  if name then
    print("Hi " .. name)
  end
end

Privacy

Lua code is beautified locally in the browser and is not uploaded.

Frequently Asked Questions

Does this validate or run Lua?
No. It formats text for readability only. Use a Lua interpreter such as lua or luajit to run or check your code.
How does it know where to indent?
It indents after block keywords like do, then, function, and repeat, and dedents at end, until, else, and elseif. Table braces are indented too.
Will it change my program behavior?
No. It only adjusts whitespace and line breaks.
Is my source code uploaded anywhere?
No. Beautification runs entirely in your browser.