Lua Minifier
Paste Lua source code and strip comments and whitespace for a smaller, deployment-ready output.
Last updated: May 29, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is Lua Minifier?
Lua Minifier removes all comment styles supported by Lua — single-line (-- comment), long comments (--[[ ... ]]), and level-bracketed long comments (--[=[ ... ]=]) — and then collapses whitespace to reduce file size. String literals and long strings ([[ ... ]]) are preserved verbatim. The output is functionally identical to the input but smaller, making it useful for embedding Lua in game engines, embedded systems, and web deployments where file size matters.
How to Use Lua Minifier
Paste Lua source code.
The minified output updates instantly.
Copy or download the minified .lua file.
Common Use Cases
- Reducing Lua script size before embedding in a game engine like Love2D or Defold.
- Minifying Lua configs before shipping in a microcontroller or IoT firmware.
- Stripping developer comments from Lua before distributing a mod or plugin.
- Preparing Lua for network transmission where payload size matters.
Example Input and Output
A Lua function with comments is minified.
-- Add two numbers
local function add(a, b)
return a + b
endlocal function add(a,b)
return a+b
endPrivacy
Lua code is processed locally in the browser and is not uploaded.
Frequently Asked Questions
Will minified Lua still run correctly?
Yes. Comment removal and whitespace collapsing are safe transformations that do not affect Lua runtime behavior.
Does it handle nested long brackets?
Yes. Long strings [[ ]] and level-bracketed forms [=[ ]=], [==[ ]==] are preserved correctly and not treated as comments.
Is my code uploaded anywhere?
No. Minification runs entirely in your browser.
Related Tools
Lua Beautifier
Beautify Lua source by indenting blocks, functions, loops, and tables based on Lua keywords like do, then, and end.
JavaScript Obfuscator
Obfuscate JavaScript code by removing comments, minifying whitespace, and encoding string literals to make source code harder to read.
HTML Minifier
Compress HTML by removing whitespace, comments, and redundant attributes — with size reduction stats.
Code Highlighter
Paste code in JavaScript, TypeScript, Python, HTML, CSS, SQL, JSON, or Bash and get a syntax-highlighted HTML snippet you can embed anywhere. Live preview and copy-ready output.
JavaScript Tester
Run and test JavaScript code directly in your browser — see console.log output, errors, and execution time instantly.
Code to Image Converter
Convert code snippets to beautiful images for sharing.

