Menu

PHP Encoder

Encode PHP source into Base64+eval, hexadecimal, GZ Deflate, ROT13, or variable-renamed output. Strip comments, minify first, split long strings, and download the result. Five methods, instant output, 100% browser-based.

PHP Encoder Studio 5 Methods
Ready
Encoding is not security. All five methods are reversible. Anyone who has your encoded file can decode it in seconds. This tool is for safe transport and light obfuscation — not for protecting secrets, API keys, or passwords. For WordPress plugins, encoding may violate GPL and will trip security scanners.
🔤 Base64 + eval encoding. Encodes the entire PHP source to Base64 and wraps it in eval(base64_decode(...)). Simple, works on any PHP version. Requires the eval() language construct, which is often disabled on hardened hosts.
PHP Input 0 chars
Encoded Output 0 chars
Complete Guide to PHP Encoding

What PHP Encoding Actually Does

PHP encoding converts readable source code into a representation that is harder to read at a glance — Base64, hexadecimal, compressed bytes, ROT13, or renamed identifiers. It is a transport transformation. Every method here is reversible, because PHP has to decode it back to execute it.

This tool gives you five encoding methods so you can match the target context:

The Five Encoding Methods

MethodOutputNeeds eval()?File SizeBest For
Base64 + evaleval(base64_decode("..."));Yes~1.33× largerSimple deployment hiding
Hex Stringeval(hex2bin("..."));Yes~2× largerByte-level transport
Variable RenameRenamed identifiers + Base64 stringsNo~1.2× largerPreserves eval-free execution
GZ Deflateeval(gzinflate(base64_decode("...")));Yes~0.4× smallerLarge files (needs PHP server)
ROT13 + Reverseeval(strrev(str_rot13("...")));Yes~1× sameLightweight, fast decode

Which Method Should You Use?

GoalRecommended Method
Hide a small script from casual readingBase64 + eval
Deploy a large file and shrink sizeGZ Deflate (requires gzdeflate on a server)
Keep eval-free execution (some hosts disable eval)Variable Rename
Lightweight, no size changeROT13 + Reverse
Byte-level transport / hiding in a text fieldHex String

Important Caveats

Four of the five methods use eval(). Many hardened PHP hosts disable eval() in php.ini (via disable_functions) as a security measure. If eval() is disabled, only the Variable Rename method will run. Also, GZ Deflate requires the server-side gzdeflate() function — the browser fallback uses Base64, which defeats the size benefit.

Why This Tool Doesn't Work for WordPress Plugins

  • GPL license. WordPress is GPL. Plugins that depend on WordPress core are derivative works and must be GPL-compatible. Obfuscating GPL code is incompatible with the license, and WordPress.org explicitly requires "code must be mostly human-readable."
  • Security scanners. Wordfence, Sucuri, and every anti-malware scanner flag eval(base64_decode(...)) as a malware signature. Even if your plugin is benign, it will be flagged as malicious.
  • Debugging. Encoded PHP produces useless stack traces. You won't be able to debug production errors.

What PHP Encoding Cannot Do

  • It cannot protect secrets. API keys, passwords, and database credentials in PHP are always extractable — the server has to read them to use them.
  • It cannot prevent reverse engineering. A determined user can decode Base64, hex, ROT13, and GZ Deflate in seconds.
  • It cannot replace licensing or authentication. Encoding is deterrence, not control.
  • It cannot improve performance. Every method here makes execution slower and most make files larger.

Encoding vs Obfuscation vs Encryption

EncodingObfuscationEncryption
GoalSafe transportHarder to readConfidentiality
Reversible?TriviallyTrivially, with effortOnly with key
Needs key?NoNoYes
What this tool does✅Partial (var rename)❌

If you need real JavaScript obfuscation, use the JS AST Obfuscator. If you need CSS class-name mangling, use the CSS Class Obfuscator. PHP encoding is a different problem with a different solution.

Frequently Asked Questions

Is PHP encoding secure?
No. It's a transport transformation, not protection. Every method here is reversible, and PHP has to decode the source back to execute it.
Does Base64 + eval work on all PHP versions?
Yes, eval() and base64_decode() exist on every PHP version from 4 onward. But many hardened hosts disable eval() in php.ini for security reasons — if yours does, only the Variable Rename method will work.
Why does GZ Deflate show a Base64 fallback in the browser?
Browsers cannot run PHP's gzdeflate(). The tool generates the correct eval(gzinflate(base64_decode(...))) wrapper, but the browser preview uses Base64 as a fallback because it can't compress server-side. To get actual GZ Deflate compression, run the encoder on a PHP server instead of in the browser.
Can I use this for a WordPress plugin?
We strongly advise against it. Obfuscating GPL code is incompatible with the license, WordPress.org explicitly requires readable code, and security scanners like Wordfence will flag eval(base64_decode(...)) as malware even when your plugin is benign. If you need to protect a commercial plugin, use a proper PHP encoder (ionCube, Zend Guard) or keep the core logic on your own server behind an API.
Can I decode the output back to PHP?
Yes. For Base64, use base64_decode(). For Hex, use hex2bin(). For GZ Deflate, use gzinflate(base64_decode()). For ROT13, use strrev(str_rot13()). For Variable Rename, the variable names are lost permanently but the logic is still readable.
Does encoding break my code?
Not if the original code was valid PHP. But the minifier and comment stripper use regex, not a real PHP parser — they can break on heredocs, nested quotes, and multi-line strings. Test the output on a staging server before deploying. If something breaks, disable Minify First and Strip Comments.
Why does the Variable Rename method mangle superglobals?
It doesn't. The tool explicitly skips $_GET, $_POST, $_SERVER, $_SESSION, $_COOKIE, $_FILES, $_REQUEST, $_ENV, $GLOBALS, and $this. If your code uses ${'dynamic'} variable syntax or string interpolation, those may still be affected.
Does the tool upload my code to your server?
No. Everything runs in your browser. Your PHP code never leaves your device.
Can I download the output as a .php file?
Yes. Click Download to save the encoded output as encoded.php.
Which method produces the smallest file?
GZ Deflate, if you actually run it on a PHP server (the browser fallback uses Base64). Base64 and ROT13 are roughly the same size as the original. Hex doubles the size.
Which method is hardest to reverse?
All five are trivially reversible. GZ Deflate looks intimidating but is one gzinflate(base64_decode(...)) call away. If you need real code protection, use ionCube or Zend Guard, which compile PHP to bytecode that requires a server-side extension to run.
Can I use this for phishing or malware?
Absolutely not. Using encoding to hide malicious PHP is illegal and unethical. This tool is intended for legitimate use — protecting legitimate code from casual inspection, safe transport, and learning.

Related Tools

External Resources