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
| Method | Output | Needs eval()? | File Size | Best For |
|---|---|---|---|---|
| Base64 + eval | eval(base64_decode("...")); | Yes | ~1.33× larger | Simple deployment hiding |
| Hex String | eval(hex2bin("...")); | Yes | ~2× larger | Byte-level transport |
| Variable Rename | Renamed identifiers + Base64 strings | No | ~1.2× larger | Preserves eval-free execution |
| GZ Deflate | eval(gzinflate(base64_decode("..."))); | Yes | ~0.4× smaller | Large files (needs PHP server) |
| ROT13 + Reverse | eval(strrev(str_rot13("..."))); | Yes | ~1× same | Lightweight, fast decode |
Which Method Should You Use?
| Goal | Recommended Method |
|---|---|
| Hide a small script from casual reading | Base64 + eval |
| Deploy a large file and shrink size | GZ Deflate (requires gzdeflate on a server) |
| Keep eval-free execution (some hosts disable eval) | Variable Rename |
| Lightweight, no size change | ROT13 + Reverse |
| Byte-level transport / hiding in a text field | Hex String |
Important Caveats
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
| Encoding | Obfuscation | Encryption | |
|---|---|---|---|
| Goal | Safe transport | Harder to read | Confidentiality |
| Reversible? | Trivially | Trivially, with effort | Only with key |
| Needs key? | No | No | Yes |
| 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?
Does Base64 + eval work on all PHP versions?
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?
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?
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?
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?
Why does the Variable Rename method mangle superglobals?
$_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?
Can I download the output as a .php file?
encoded.php.Which method produces the smallest file?
Which method is hardest to reverse?
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.