Lua Minifier

Compress your Lua code by removing whitespace, comments, and formatting instantly.

Input Lua
Minified Output
Minified output will appear here...
info

About Lua Minifier

Lua scripts used in game engines, embedded systems, and configuration files are often written with comments, generous spacing, and indentation for readability. When deploying Lua scripts to production — especially in resource-constrained environments like game mods or IoT devices — reducing file size matters. Lua Minifier removes every line comment, every block comment, and all unnecessary whitespace from your code, compacting it into the smallest valid single-line form that executes identically to the original.

Common scenarios where this tool pays off include shipping Roblox or Luau scripts under size limits, trimming WoW or FFXIV addon files before packaging, reducing overhead in Love2D game builds, and cleaning up embedded Lua modules in firmware images or NGINX configurations. Because Lua ignores whitespace outside string literals, the compact output runs byte-for-byte equivalently while cutting file size by 20–60% for typical scripts with moderate documentation.

All minification runs entirely inside your browser using JavaScript. Your source code is never uploaded, stored, or transmitted to any server — making this tool safe for proprietary game code, internal tooling, and client work under NDA. There are no file size limits, no accounts required, and no cost.

star

Key Features

check_circle

Removes both comment styles

Strips single-line comments starting with -- and multi-line block comments wrapped in --[[ ... ]], leaving no comment artifacts in the output.

check_circle

Collapses all whitespace

Newlines, tabs, and runs of spaces are folded into a single space, producing compact single-line output without breaking operator spacing or string literals.

check_circle

100% client-side processing

Minification runs in your browser. Your Lua source never leaves your device — safe for proprietary game scripts, licensed addons, and confidential firmware code.

check_circle

Live size savings report

After minification, a stats bar shows the original character count, minified character count, and the exact percentage saved so you can confirm the reduction.

check_circle

File upload and download

Load .lua or .txt files directly from disk and download the minified result as minified.lua — no copy-paste needed for large scripts.

check_circle

Works with Luau and Lua variants

Handles standard Lua 5.x syntax used in Roblox Luau, Love2D, NGINX, WoW addons, and embedded environments without requiring version-specific configuration.

help

How to Use

01

Paste Your Lua Code

Copy your formatted Lua script and paste it into the input editor on the left.

02

Minify

Click "Minify" to strip all comments and whitespace from your Lua code.

03

Copy the Result

Review the size savings, then copy the minified Lua or download it as a .lua file.

code_blocks

Example

Line comments, block comments, indentation, and blank lines are all removed. The remaining code is collapsed into a single compact line.

Formatted Lua input
--[[
  Greet a player by name.
  Returns a greeting string.
]]
local function greet(name)
  -- Build the message
  local msg = "Hello, " .. name .. "!"
  return msg
end

print(greet("World"))
Minified output
local function greet(name) local msg = "Hello, " .. name .. "!" return msg end print(greet("World"))
lightbulb

Common Use Cases

  • arrow_circle_right

    Roblox and Luau script size reduction

    Roblox enforces script size limits and charges bandwidth for place files. Minifying Luau modules and LocalScripts before publishing reduces place file size and speeds up client loading without touching any game logic.

  • arrow_circle_right

    WoW and FFXIV addon packaging

    World of Warcraft and Final Fantasy XIV addons are distributed as file bundles where every kilobyte counts. Stripping developer comments and formatting before release keeps the downloadable package lean without maintaining a separate build pipeline.

  • arrow_circle_right

    Embedded Lua in firmware and IoT devices

    Microcontrollers running NodeMCU, ESP8266, or similar Lua-capable firmware have tight flash storage budgets. Minifying scripts before flashing them lowers memory footprint and can be the difference between fitting or not fitting the module.

  • arrow_circle_right

    NGINX and OpenResty Lua modules

    Lua blocks embedded in NGINX configuration via ngx_lua or OpenResty are loaded on every worker start. Removing comments and excess whitespace from long filter or auth scripts trims parse time and reduces the config footprint.

  • arrow_circle_right

    Love2D and game jam builds

    Love2D games are distributed as .love zip archives. Minifying all Lua source files before packing the archive cuts download size for players and speeds up the initial require chain on slower machines.

quiz

Frequently Asked Questions

What is Lua Minification? expand_more
Lua minification removes unnecessary whitespace, line breaks, indentation, and comments from Lua scripts without changing their functionality. The result is compact code that executes identically to the original.
Will minifying break my Lua script? expand_more
No. The minifier only removes characters that Lua ignores during execution — whitespace and comments. All code logic, variable names, and string literals are preserved exactly as written.
Is my Lua code secure? expand_more
Yes. All processing runs entirely in your browser. Your code never leaves your machine and is not sent to any external server.
Does this work with Roblox Luau scripts? expand_more
Yes. The minifier handles standard Lua syntax which covers Roblox Luau, Love2D, and other Lua-based environments. Comments and whitespace are safely removed regardless of the Lua variant.
How is the Lua Minifier different from the Lua Beautifier? expand_more
These tools are opposites. The Lua Beautifier adds indentation, spacing, and formatting to make code easier to read during development. The Lua Minifier removes all that formatting to produce the smallest possible file for deployment. Use the Beautifier when you receive minified third-party code you need to inspect, and use the Minifier when you are done editing and want to ship a compact build.
Are string contents preserved during minification? expand_more
Yes. The minifier only targets whitespace and comments outside of string literals. Characters inside single-quoted, double-quoted, and long-bracket strings are left completely untouched.
Does it remove block comments like --[[ ... ]]? expand_more
Yes. Both single-line comments (-- text) and multi-line block comments (--[[ ... ]]) are removed. The output contains no comment text from the original source.
Is there a file size limit? expand_more
There is no enforced limit. Because all processing runs locally in your browser, you can minify files of any size — performance depends only on your device hardware.