FiveM Lua Code Formatter & Beautifier

Paste your Lua code, format it with proper indentation, or minify it for production. Syntax highlighting included.

Input: 0 Output: 0
Input (Raw Lua)
Output (Formatted)

What this tool is for

Lua has no compiler that enforces layout, so code from three different authors ends up in three different shapes, and a nesting mistake hides in the indentation. This formatter rebuilds the indentation from the actual block structure, which makes an unclosed if or function visible at a glance, and can minify the result when file size matters.

How to use it

  1. Step 1:

    Paste your Lua code into the input field.

  2. Step 2:

    Choose the indentation width. Two spaces is the common style in FiveM resources.

  3. Step 3:

    Format. If the indentation looks wrong afterwards, that is the point: the structure really is off.

  4. Step 4:

    Copy the result back into your file, or use minify for code you ship rather than edit.

Frequently asked questions

Does formatting change what my code does?

No. Only whitespace and line breaks change, never tokens, strings or comments. The formatted file behaves exactly like the original one.

Two spaces or four?

Two is the prevailing style in the FiveM ecosystem, and it keeps deeply nested callback code readable. What matters more than the number is that one resource uses one setting throughout.

Should I minify my resources?

Rarely. Lua is loaded once at resource start, so the size gain does not show up in gameplay, and a minified file makes every future error report useless. Minify only what you never need to debug.

Why does the indentation still look wrong after formatting?

Because there is a real structural error. A missing end or a wrongly closed block moves everything after it one level in, and the formatter shows exactly where it starts. Run the config validator on the file to get the line number.