PHP Serialize Online — Free Serializer Tool

Convert JSON and PHP data structures into PHP serialized format instantly. Ideal for WordPress metadata, Laravel cache values and session storage. All processing happens in your browser — no data sent to any server.

Loading…
PHP Serialize
Using PHP's serialize() function to convert JSON data structures into compact PHP serialized format.

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";}}

Serialization options

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
$data = [ 'config' => (object)[], 'name' => 'test', 'active' => true, 'settings' => (object)[] ];
With removeEmptyObjects: true
a:2:{s:4:"name";s:4:"test";s:6:"active";b:1;}
With removeEmptyObjects: false
a:4:{s:4:"name";s:4:"test";s:6:"config";O:8:"stdClass":0:{}s:6:"active";b:1;s:8:"settings";O:8:"stdClass":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

See Beautify indentation options →

What this serializer does

Serialize JSON into valid PHP serialized strings for WordPress, Laravel caches and session storage — entirely in your browser.

Serialize JSON → PHP

Convert JSON data structures into PHP serialized format instantly. Supports arrays, objects, strings, numbers, booleans and null values.

JSON ↔ PHP workflows

Ideal when you need PHP serialize format for WordPress metadata or Laravel cache values while editing data as JSON.

Need to decode instead?

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

How to Serialize PHP Data Online

Paste JSON (or a JSON-compatible structure) into the left editor, adjust serialization options if needed, then click Serialize. FastMinify produces a valid PHP serialized string with correct type prefixes and string lengths — useful for WordPress options, Laravel cache values and session payloads. Everything runs in your browser; nothing is sent to a server. To decode an existing serialized string instead, use PHP Unserialize.

PHP Serialize vs JSON — When to Use Which

PHP's serialize() format preserves type information including objects and references, while JSON is a universal interchange format. Use PHP serialization when working within PHP ecosystems (WordPress, Laravel, session storage). Use JSON when you need interoperability with JavaScript, APIs, or other languages. Pair this serializer with the JSON tool when you need to minify or pretty-print the JSON side.

PHP Serialize FAQ

Serialize JSON to PHP — privacy-local answers

Why serialize PHP data?

PHP serialization converts arrays and objects into a compact string for databases, sessions or cache. It preserves PHP-specific type information that JSON cannot represent, such as object classes and 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 and objects are serialized recursively with their keys and values.

Can I serialize PHP arrays and objects?

Yes. Paste JSON that represents arrays (indexed or associative), nested objects, strings, numbers, booleans and null. The tool converts it to valid PHP serialized format with correct lengths.

What is the difference between PHP serialize and JSON?

PHP serialize preserves PHP-specific types (objects, class names, references) while JSON is a universal format. JSON travels better across languages; PHP serialization retains more PHP type detail. Use this page to encode; use PHP Unserialize to decode.

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 for debugging.

Serialization

Serialize and deserialize PHP data structures beside JSON workflows.

Explore other tool categories

Minify

Shrink code and assets for production — minify JavaScript, CSS, HTML, JSON and XML before gzip or CDN deploy.

Beautify

Make code readable with consistent indentation — beautify JavaScript, CSS, TypeScript, SCSS, LESS, Markdown, GraphQL, SQL, YAML and more in your browser.

Unminify

Expand minified or compressed code — unminify JavaScript, CSS, TypeScript, SCSS, LESS, SQL, YAML and other formats when debugging or reviewing.

Conversion

Transform data between JSON, YAML, XML and CSV locally — no server uploads.

JSON Tools

Validate, format, diff and explore JSON payloads — complementary to minifiers and converters.

SVG Tools

Preview, optimize with SVGO, export Data URI, resize, beautify, convert to JSX and validate SVG — all in your browser.

DevOps & Infra

Terraform HCL format/validate/minify, Dockerfile format & lint, Docker Compose and .env validation.

CI/CD

GitHub Actions and GitLab CI — format YAML and check workflow/job structure in your browser.

Logs & observability

Line-oriented JSON/NDJSON and Nginx/Apache access logs — format, filter, validate, and CSV/TSV.

Kubernetes

Multi-doc manifests, structural validate, Ingress/Deployment starters, and Helm values formatting.

Networking / IP

CIDR, subnets, and IPv4/IPv6 helpers — in your browser.

Security & tokens

JWKS, X.509 certificates, and secrets scan — browser-local.

API & schemas

OpenAPI tools to format, validate, and lint your specs.

Encoding

Encode or decode Base64, URL components and HTML entities — client-side only.

Developer utilities

Timestamps, UUID, ULID, Nanoid, cron, passwords, regex, slugify, number bases, case, text diff, and chmod — all client-side.