PHP Toolkit

Unserialize PHP data to readable JSON, or serialize JSON back to PHP format

  • 100% Free
  • Files stay private
  • Works in your browser
Try it now·PHP Toolkit

PHP serialized string

Paste a PHP serialized blob to inspect it as readable JSON.

This tool re-implements PHP's serialization format in pure JavaScript and runs entirely in your browser. It does not execute a real PHP runtime, so custom-object (O:) payloads and other PHP-internal types are not supported.

How it works

  1. Choose a direction

    Pick Unserialize to turn a PHP serialized string into JSON, or Serialize to turn JSON into a PHP serialized string.

  2. Paste your input

    Paste your text into the input box, then press Unserialize to JSON or Serialize to PHP. It all runs in your browser.

  3. Copy or download the result

    The converted text appears in the output box. Press Copy to grab it, or Download to save it as a file.

Paste a PHP serialized string and read it back as clean JSON, or take a JSON object and turn it into the exact serialized format PHP writes to sessions and caches. Everything runs in your browser, so nothing you paste is ever uploaded.

What Is PHP Toolkit?

PHP Toolkit is a free, in-browser converter for PHP's serialize format. When PHP saves a session, a cached value, or a WordPress option, it stores arrays and objects in a compact string like a:2:{s:4:"name";s:4:"John";i:0;i:42;}, which is almost impossible to read by eye. This tool decodes that string into readable JSON, and goes the other way too, taking a JSON value and producing the serialized string PHP would expect. It implements the serialize and unserialize logic directly in JavaScript, so it handles strings, integers, floats, booleans, null, and nested associative arrays without needing a server. One thing to be clear about: it is not a real PHP interpreter, so it converts data structures, not live objects with class methods.

Who Benefits from This Tool

  • WordPress developers: decode a serialized wp_options or post-meta value to see what a plugin actually stored.
  • Laravel and Symfony engineers: inspect a serialized session or cache entry while debugging a stubborn state bug.
  • Database administrators: read a serialized column dumped from MySQL without spinning up a PHP shell.
  • Backend developers migrating data: convert PHP-serialized records into JSON that another language can consume.
  • QA engineers: verify that the array a form saved matches the serialized blob sitting in the database.
  • Students learning PHP internals: see exactly how the a:, s:, and i: markers map to real values.

Key Features

  • Unserialize to JSON: turn a raw PHP serialized string into formatted, readable JSON in one step.
  • Serialize from JSON: paste a JSON object or array and get the matching PHP serialized string back.
  • Nested structure support: handles multi-level associative arrays, not just flat key-value pairs.
  • Type-aware output: preserves strings, integers, floats, booleans, and null as their correct types.
  • Copy-ready results: grab the converted output and drop it straight into your code or a database field.
  • Fully in-browser: the conversion runs locally in JavaScript, so your data is never sent to a server.

How to Use

  1. Choose the direction you need: PHP serialized string to JSON, or JSON to PHP serialized string.
  2. Paste your input into the text box, for example a serialized session value or a JSON array.
  3. Run the conversion to generate the output in the other format.
  4. Read the result and check that the keys, values, and types look correct.
  5. Copy the converted output and use it in your code, config, or database.

Common Use Cases

  • Decoding a serialized WordPress option to find out which setting a theme wrote.
  • Inspecting a Laravel session payload while chasing down a login-state bug.
  • Converting serialized MySQL column data into JSON for an export script.
  • Building a serialized string by hand to seed test data into a PHP cache.
  • Checking that a migrated record kept its structure after moving between systems.

Tips and Best Practices

  • Copy the serialized string exactly, including the trailing semicolon and closing brace, or unserializing will fail on a truncated blob.
  • Watch the string length markers. The s:4 in s:4:"name" must match the real byte count, which multibyte characters can throw off.
  • Validate your JSON before serializing it, since a stray comma or unquoted key will stop the conversion.
  • Use the JSON output as a quick sanity check when a serialized value from the database looks wrong.
  • Keep sensitive session data local. Because this runs in your browser, you can safely paste production values without them leaving your machine.

Limitations and Notes

PHP Toolkit converts data structures, not code. It does not run a real PHP interpreter, so it cannot restore serialized objects that depend on class definitions, magic methods, or custom __wakeup behavior. Serialized custom objects (the O: marker) are treated as data and will not come back as live instances. Because the serialize format is byte-length sensitive, strings that were serialized with a different character encoding may report mismatched lengths. It is a developer and debugging aid, not a security tool: never treat unserializing untrusted input as safe in your own PHP code, since real unserialize() can be exploited.

FAQs

No. It reimplements PHP's serialize and unserialize format in JavaScript, so it converts the data structure only. There is no PHP interpreter, meaning class methods and object logic are not executed.

It can read the data inside a serialized object marker and show you its properties, but it cannot rebuild a live object because that requires the original class definition. For plain arrays and scalar values it works fully.

The most common cause is a truncated or edited string. The format needs the exact length prefixes and the closing braces to be intact. Copy the whole value straight from the source, and double-check that multibyte characters have not shifted the length counts.

No. The entire conversion happens in your browser, so nothing you paste is sent to a server. That makes it safe to inspect production session or database values.

Strings, integers, floats, booleans, null, and nested associative arrays all convert correctly in both directions. These cover the vast majority of serialized values you will meet in sessions, caches, and WordPress options.

Yes. The serialized string it produces is valid input for PHP's unserialize(), and the JSON it produces is standard JSON any language can parse. Copy whichever side you need and paste it into your project.

More Website Management Tools

Other tools in Website Management Tools.

All Website Management Tools