PHP Serialize Online — Free Serializer Tool

Convert JSON or PHP array syntax into PHP serialize() format instantly. Ideal for WordPress-shaped arrays, Laravel cache values and session storage. All processing happens in your browser — no data sent to any server.

Loading…
PHP Serialize
Convert JSON or PHP array syntax into PHP serialize() format in your browser.

Basic example

Input JSON data

{ "app": "FastMinify", "version": "2.1.0", "features": { "minify": true, "0": "legacy", "1": "modern" }, "flags": [true, false, null], "metadata": { "author": "Team", "license": "MIT" } }

Serialized PHP data

a:5:{s:3:"app";s:10:"FastMinify";s:7:"version";s:5:"2.1.0";s:8:"features";a:3:{s:1:"0";s:6:"legacy";s:1:"1";s:6:"modern";s:6:"minify";b:1;}s:5:"flags";a:3:{i:0;b:1;i:1;b:0;i:2;N;}s:8:"metadata";a:2:{s:6:"author";s:4:"Team";s:7:"license";s:3:"MIT";}}

How to Serialize PHP Data Online

Paste JSON or PHP array syntax in the left editor. Leave Input format on Auto unless detection picks the wrong parser, then click Serialize. FastMinify stays in your browser and emits array and scalar tokens (a:, s:, i:, d:, b:, N;). Nested JSON objects become PHP arrays — not O: class objects or R: references. To decode an existing a:3:{…} string, use PHP Unserialize.

PHP Serialize vs JSON — When to Use Which

JSON is what you edit here; PHP serialize() is the compact string many PHP apps store (WordPress options, Laravel cache, sessions). Use JSON for APIs and other languages; use this page when a PHP stack already expects serialize() output. This encoder does not keep class names or references. Pretty-print or minify the JSON side with the JSON tool.

Serialization options

Input format
Auto detects JSON vs PHP array syntax (`$data = …`, `array(…)`, `=>`). Override when Auto picks the wrong parser.
JSON
{"name": "test"}
PHP array
$data = ['name' => 'test'];

Both produce the same serialize() array tokens:

a:1:{s:4:"name";s:4:"test";}
Include Null Values
Includes properties with null values in the output

Comparison with/without option:

Original code
$data = [ 'name' => 'test', 'value' => null, 'active' => true, 'count' => null ];
With includeNullValues: true
a:4:{s:4:"name";s:4:"test";s:5:"value";N;s:6:"active";b:1;s:5:"count";N;}
With includeNullValues: false
a:2:{s:4:"name";s:4:"test";s:6:"active";b:1;}
Difference
Properties with null values are included in the output
Remove Empty Arrays
Removes empty arrays from the result

Comparison with/without option:

Original code
$data = [ 'items' => [], 'name' => 'test', 'active' => true ];
With removeEmptyArrays: true
a:2:{s:4:"name";s:4:"test";s:6:"active";b:1;}
With removeEmptyArrays: false
a:3:{s:5:"items";a:0:{}s:4:"name";s:4:"test";s:6:"active";b:1;}
Difference
Empty arrays are removed from the result
Remove Empty Objects
Removes empty objects from the result

Comparison with/without option:

Original code
{ "config": {}, "name": "test", "active": true, "settings": {} }
With removeEmptyObjects: true
a:2:{s:4:"name";s:4:"test";s:6:"active";b:1;}
With removeEmptyObjects: false
a:4:{s:6:"config";a:0:{}s:4:"name";s:4:"test";s:6:"active";b:1;s:8:"settings";a:0:{}}
Difference
Empty objects are removed from the result
Sort Keys
Sorts object keys alphabetically in the output

Comparison with/without option:

Original code
$data = [ 'zebra' => 'striped', 'apple' => 'red', 'banana' => 'yellow' ];
With sortKeys: true
a:3:{s:5:"apple";s:3:"red";s:6:"banana";s:6:"yellow";s:5:"zebra";s:7:"striped";}
With sortKeys: false
a:3:{s:5:"zebra";s:7:"striped";s:5:"apple";s:3:"red";s:6:"banana";s:6:"yellow";}
Difference
Object keys are sorted alphabetically in the output

Decode a serialized string with PHP Unserialize →

What this serializer does

Serialize JSON or PHP array syntax into serialize() strings for WordPress-shaped arrays and Laravel caches — entirely in your browser.

JSON or PHP array → serialize()

Convert JSON or PHP array syntax into PHP serialize() format. Arrays, strings, numbers, booleans and null. Nested JSON objects are emitted as PHP arrays.

WordPress- and Laravel-shaped arrays

Use when you edit data as JSON or a PHP array and need serialize() output for options, cache values or session-shaped arrays.

Need to decode instead?

Paste a PHP serialized string into the PHP Unserialize tool to decode it to readable JSON or PHP array syntax.

PHP Serialize FAQ

Serialize JSON to PHP — privacy-local answers

Why serialize PHP data?

PHP stacks store arrays in a compact serialize() string for databases, sessions or cache. This page encodes JSON or PHP array syntax into those array and scalar tokens — it does not emit class objects or references.

How does PHP serialization work?

PHP's serialize() encodes data with type prefixes and string length markers. For example, a string becomes s:5:"hello" where s is the type and 5 is the length. Arrays are serialized recursively. JSON objects become a: arrays here, not O: class objects.

Can I serialize PHP arrays and objects?

Paste JSON or PHP array syntax: indexed or associative arrays, nested maps, strings, numbers, booleans and null. Nested JSON objects are emitted as PHP arrays. PHP class objects (O:) and references (R:) are not produced.

What is the difference between PHP serialize and JSON?

JSON travels across languages; serialize() is the wire format many PHP apps store. Encode JSON or a PHP array here; decode a serialized string with PHP Unserialize.

Is my data processed securely?

Yes. Serialization runs entirely in your browser with JavaScript. No payload is sent to FastMinify servers.

I need to decode a serialized string instead — where?

Open PHP Unserialize. That dedicated page decodes serialized PHP into readable JSON or PHP array syntax.

Verify it yourself

FastMinify processes your input in the browser. Inspect the network panel or read our validation gate to confirm nothing leaves your device.

Serialize and deserialize PHP data structures beside JSON workflows.