{ PHP Serializer/Unserializer }

// serialize & unserialize php data in one click

Serialize PHP arrays and objects to strings, or unserialize PHP serialized data back to readable format. Browser-based, free, no sign-up required.

Paste a PHP serialized string, e.g. a:2:{s:3:"foo";i:1;s:3:"bar";b:1;}
TRY SAMPLE:
⚡

Ready to convert

Paste input and click Convert

HOW TO USE

  1. 01
    Choose a Mode

    Select Unserialize to decode a serialized PHP string, or Serialize to convert JSON/array data into a PHP serialized string.

  2. 02
    Paste Your Input

    Paste the serialized string or valid JSON into the input box. Use the sample buttons to try examples instantly.

  3. 03
    Click Convert

    Hit Convert and see the result immediately. Copy the output with one click.

FEATURES

Serialize Unserialize Pretty Print Error Messages Sample Data No Upload

USE CASES

  • 🔧 Debug PHP session data stored in databases
  • 🔧 Inspect WordPress serialized options
  • 🔧 Convert arrays to serialized format for storage
  • 🔧 Analyze WooCommerce product meta
  • 🔧 Reverse-engineer legacy PHP app data

WHAT IS THIS?

PHP's serialize() converts arrays and objects into a compact, storable string representation. This tool lets you convert data in both directions — serialize JSON into a PHP string, or decode a serialized string back into a human-readable structure — all in your browser.

RELATED TOOLS

FREQUENTLY ASKED QUESTIONS

What does PHP serialize() do?

PHP's serialize() function converts a PHP value — array, object, string, int, bool, or null — into a storable string representation. The result can be saved in a database, file, or session and later restored with unserialize().

How do I read a PHP serialized string?

A serialized string has a compact format: a: for arrays, s: for strings, i: for integers, b: for booleans, O: for objects, and N; for null. This tool automatically decodes it into a human-readable structure.

Can I serialize any PHP type?

You can serialize arrays, objects, strings, integers, floats, booleans, and null. Resources (like database connections or file handles) cannot be serialized.

Is unserialized data safe?

Unserializing untrusted data is a known PHP security risk. PHP can instantiate arbitrary classes during unserialization, which may trigger dangerous code. Always validate and whitelist allowed classes in production code. This tool runs the process server-side in a sandboxed context.

What input format does Serialize mode expect?

The Serialize mode expects valid JSON as input — arrays, objects, strings, numbers, booleans, or null. This JSON is decoded and then passed through PHP's serialize() to produce the serialized string output.

Why does WordPress use serialized data?

WordPress stores many settings, plugin configurations, and post meta as serialized PHP strings in the wp_options and wp_postmeta database tables. Being able to read and edit these values is essential for debugging and migrations.

Is my data sent to a server?

Yes — the conversion is performed server-side via a PHP API endpoint because PHP serialization is a PHP-native feature. However, no data is stored, logged, or retained after the request completes.

What does "malformed serialized string" mean?

It means the string doesn't follow the PHP serialization format — perhaps it was truncated, corrupted, or is not actually a serialized value. Try checking the string length byte counts (e.g. s:3:"foo" requires exactly 3 characters between the quotes).

PHP Serializer and Unserializer — Free Online Tool

PHP serialization is a foundational mechanism in the PHP ecosystem. Whether you're debugging a WordPress database, building a caching layer, or reverse-engineering a legacy application, understanding serialized PHP data is an everyday developer task. This free online PHP Serializer/Unserializer lets you instantly convert in both directions — no setup, no installation, no sign-up required.

What Is PHP Serialization?

PHP serialization is the process of converting a PHP value into a flat string that can be stored or transmitted and later reconstructed. The serialize() function was introduced very early in PHP's history and remains in widespread use today, particularly in:

The PHP Serialization Format

PHP serialized strings follow a compact, type-annotated format. Each value is prefixed with a type code and length indicator:

One subtle aspect of the format is that string lengths are byte counts, not character counts. For multibyte strings (e.g. UTF-8 encoded Chinese or Arabic text), the byte count will differ from the visible character count. This is a common source of corruption when serialized strings are manually edited.

How to Unserialize PHP Data

Unserialization takes a PHP serialized string and reconstructs the original value. In PHP code this is simply unserialize($str). This tool performs the same operation server-side and displays the result in a pretty-printed, human-readable format. Arrays are shown with their key-value pairs, objects with their class name and properties, and primitives as their literal values.

Common scenarios where you'll need to unserialize:

How to Serialize PHP Data

The Serialize mode accepts JSON as input. JSON is the natural interchange format for structured data, and this tool converts it to a PHP serialized string using the same rules as PHP's native serialize() function. This is useful when you need to insert serialized data directly into a database, generate test fixtures for PHP unit tests, or prepare data for a PHP application from a non-PHP environment.

PHP Serialization vs JSON

Both serialization and JSON are common ways to store structured data as a string, but they serve different purposes:

Modern PHP applications increasingly prefer JSON (via json_encode()/json_decode()) for new data storage, while serialization appears most commonly in legacy code and systems like WordPress.

Security Considerations

PHP unserialization of untrusted data is a well-documented attack vector. When PHP unserializes an object, it may instantiate PHP classes present in the codebase and trigger magic methods like __wakeup() or __destruct(). This can lead to Remote Code Execution (RCE) in some configurations — a class of vulnerability known as PHP Object Injection.

Best practices when working with serialized data in production:

WordPress and Serialized Data

WordPress is one of the most common reasons developers encounter PHP serialized strings. WordPress stores a wide variety of data as serialized strings in the wp_options table — widget settings, theme mods, plugin configurations, and more. When performing database migrations, search-and-replace operations, or debugging plugin issues, being able to decode these strings is essential.

A critical warning for WordPress developers: never do a plain text search-and-replace on serialized data in the database. Because serialized strings contain byte-length prefixes, changing the URL or domain embedded in a serialized string requires recalculating all affected lengths. Use proper tools like WP-CLI's search-replace command, which handles serialized data automatically.

About This Tool

This PHP Serializer/Unserializer is part of JLV DevTools, a free collection of browser-based utilities for developers. The conversion runs server-side via PHP for accuracy, but no data is stored or logged. The tool supports all standard PHP serializable types: scalars (int, float, string, bool, null), arrays, and objects.

☕