Code · Made a little simpler

Lua Formatter

Use StyLua to format Lua tables, functions, conditions and multiline strings locally. Choose the Lua version and indentation, then copy or download the result.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

StyLua 2.6.0 runs on this device.

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

Lua Formatter: how to use it

  1. Paste a complete Lua file or load the example with a table and multiline string.
  2. Choose the Lua version used by your project and set tabs, two spaces or four spaces.
  3. Select Format Lua. Inspect the parsed output or follow the reported error, then copy or download the Lua file.

Limits and notes

Uses StyLua 2.6.0 with output syntax-tree verification for standard Lua 5.1, 5.2, 5.3 and 5.4. The browser worker accepts up to 125,000 characters and treats the program as source text.

How your privacy works →

Lua Formatter: common questions

Which version should I select for bitwise operators?

Choose Lua 5.3 or 5.4 for native bitwise operators such as & and <<. Choose the version your project actually runs.

Do spaces inside a Lua long-bracket string count?

Yes. A long-bracket string can contain spaces and line breaks in its value. The worked example preserves two leading spaces on the second content line.

What does output verification check?

StyLua parses the formatted source and compares its syntax tree with the input. The application can still rely on behaviors outside syntax, so run your own project tests when adopting changes.

Tool guides