Skip to content
gohacks.dev
Standard Library

PHP Unserialize and Serialize

Read PHP serialize() output from WordPress options, sessions, caches and queue payloads as JSON, or serialize JSON the way PHP would.

Free · No sign-up · Your inputs stay in your browser

Input

Read PHP serialized data

Output

Result

100 characters

String lengths in serialize() are counted in bytes, not characters: 'Zoë' is s:4. A search-and-replace on a database dump that changes a string's byte length breaks every serialized value it touches, which is the classic WordPress domain-migration bug. Objects are shown with their class name; nothing is instantiated.

Runs in this browser. Nothing you paste is sent to a server.

Lengths are in bytes

A serialized string records its length in bytes, so s:4:"Zoë"; is correct because ë takes two bytes in UTF-8. Replace text in a database dump and the lengths no longer match, and unserialize() returns false for the whole value. That is the classic way a WordPress domain migration breaks widgets and theme settings; tools such as wp search-replace rewrite the lengths as they go.

Never unserialize untrusted input

The PHP manual warns that unserialize() on user input can instantiate objects whose magic methods run code. Use JSON for data that crosses a trust boundary, or pass ['allowed_classes' => false]. This tool only reads the text and never creates objects.

Share

Frequently asked questions

Why does unserialize() return false?
Usually a string length no longer matches its content, because the data was edited, truncated or re-encoded. Paste it here to see where parsing stops.
What do 'protected:' and 'private:' mean in the output?
PHP stores protected properties with a \0*\0 prefix and private ones with \0ClassName\0. The tool shows them as protected: and private: so they are readable.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools