Zero Signup ToolsFree browser tools

Developer Tools

PHP Serialize and Unserialize

Decode PHP serialize() strings into a readable preview, or encode JSON back into the PHP wire format. Works on WordPress, Laravel, and session data.

Parse a PHP serialize() string into a readable JSON-style preview.

Try a sample:

PHP serialize() format reference

These are the only tokens this tool emits. The reference matches what PHP's native serialize() function produces. Custom Serializable (C:) and reference (r:, R:) tokens are intentionally rejected because they require user PHP code to evaluate safely.

TokenMeaningExample
N;nullN;
b:0; / b:1;booleanb:1;
i:<int>;signed integeri:42;
d:<float>;double / float (INF, -INF, NAN allowed)d:3.14;
s:<bytes>:"<raw>";string. Length is in UTF-8 bytes, not characters.s:5:"hello";
a:<count>:{ k0; v0; ... }array (associative or sequential). Keys are integers or strings.a:1:{s:1:"a";i:1;}
O:<nlen>:"<class>":<count>:{ k0; v0; ... }object. Class name is preserved. Private/protected keys are NUL-padded.O:8:"stdClass":1:{s:1:"x";i:1;}

How to use

  1. Pick Unserialize to read a PHP serialize() string, or Serialize to convert JSON into the PHP wire format.
  2. Paste your input on the left. The output panel on the right updates as you type, with a green Parsed or Serialized banner when the input is valid.
  3. Use the sample buttons to load a worked example. Decode samples cover simple arrays, associative arrays, WordPress wp_options, stdClass objects, and nested mixed-type values.
  4. Read the structure summary below the output to see the top-level type, total node count, max depth, and string, array, and object counts at a glance.
  5. Click Copy to grab the preview JSON (Unserialize mode) or the serialize() string (Serialize mode) and paste it into your code, database, or bug report.
  6. If the parser surfaces an error, check the message: a mismatched s: byte length or a stray quote around an embedded string is the most common cause when a copy-paste truncates the input.

About this tool

PHP Serialize and Unserialize Tool reads and writes the exact wire format used by PHP's native serialize() and unserialize() functions. Paste a serialized string copied out of a WordPress wp_options row, a Laravel cache entry, a Doctrine result-set cache, a PHP session payload, or any value emitted by serialize(), and the tool walks the bytes with a strict recursive-descent parser and shows the result as a readable JSON-style preview. It handles every primitive type (N for null, b for boolean, i for integer, d for double with INF, -INF, and NAN literals), strings with their PHP byte-length prefix (string length is counted in UTF-8 bytes the same way PHP measures it, so multibyte content round-trips cleanly), sequential arrays, associative arrays with integer or string keys, and objects with their original class name preserved. Private and protected object properties (which PHP encodes as NUL-padded keys: NUL Class NUL prop for private, NUL star NUL prop for protected) are detected and surfaced with a friendlier display so the preview stays readable without losing the visibility information. The encoder reverses the operation: paste any JSON value and the tool emits a portable serialize() string that PHP's own unserialize() will accept byte for byte. Numbers that fit the safe-integer range are emitted as PHP integers, others fall back to doubles. Object keys that look like canonical non-negative decimal integers are coerced to integer keys, matching PHP's own promotion rule so sequential arrays come back as sequential arrays. Custom Serializable tokens (C:) and reference tokens (r:, R:) are intentionally rejected on the decode side, because resolving them would require evaluating user PHP code; the parser flags them with a clear error rather than silently producing the wrong tree. Parsing and emission run locally in your browser through TextEncoder and TextDecoder, so the wp_options dump, session payload, or cache entry you paste here never leaves your device.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools