FiveM Lua Code Formatter & Beautifier
Paste your Lua code, format it with proper indentation, or minify it for production. Syntax highlighting included.
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
- Step 1:
Paste your Lua code into the input field.
- Step 2:
Choose the indentation width. Two spaces is the common style in FiveM resources.
- Step 3:
Format. If the indentation looks wrong afterwards, that is the point: the structure really is off.
- 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.
Related tools
FiveM Config.lua Validator & Checker
Validate FiveM Config.lua files instantly. Check for syntax errors, missing commas, unclosed strings, unmatched brackets. Highlights errors with line numbers.
JSON to Lua Table Converter for FiveM
Convert JSON to Lua table syntax and Lua tables back to JSON. Handles nested objects, arrays, booleans, null to nil. Syntax highlighted output for FiveM developers.
FiveM Event Logger & Debugger Tool
Generate FiveM event listener code for server and client. Event naming validator, security checker, and template generator for common FiveM event patterns.