Home » Developer Tools » PHP Minifier
Paste PHP and get a smaller version in seconds, with strings, heredoc, and HTML kept intact.
Your code never leaves your browser. Everything runs locally on your device.
PHP files often carry comments and extra whitespace that add nothing at run time. The PHP Minifier removes comments and collapses whitespace inside your PHP blocks, so your files become smaller without changing what they do.
PHP needs careful handling: text that looks like a comment inside a string is not a comment, heredoc content must never be touched, and HTML mixed with PHP must be left alone. This tool handles all three. Everything runs in your browser, so your code is never uploaded to a server.
Yes, it is completely free with no sign up and no limits. You can minify as much PHP as you like, as often as you like.
Yes. Minifying only removes comments and extra whitespace inside PHP blocks. Your logic, strings, and HTML stay unchanged.
No. Text inside strings, heredoc, and nowdoc blocks is preserved exactly, even when it contains comment markers.
Yes. HTML outside PHP blocks is left untouched, and only the PHP blocks themselves are minified.
No. All minifying happens in your browser on your own device, so your code never leaves your computer.
It gives a small saving in parsing work and file size. For real PHP speed, a good OPcache setup matters more, and minifying is best seen as a tidy extra, not a replacement for it.
If your PHP needs tidying up instead of shrinking, try the PHP beautifier to format it into clean readable code.