Input

Output

What is JSON to MessagePack?

You have a JSON payload that's about to go over a tight WebSocket budget or into a cache that bills by the byte. MessagePack usually makes it smaller than the same data as minified JSON (the sample on this page goes from 119 bytes to 94, about 21% smaller), and it keeps the schemaless, "just an object" feel that makes JSON pleasant to work with. This page encodes whatever JSON you paste on the left into a msgpack byte stream on the right, shown as base64 by default and switchable to hex with one click.

Encoding runs entirely in your browser using the official @msgpack/msgpack library, so the JSON never leaves the tab. The input is parsed as standard RFC 8259 JSON, with one twist: integers too big for a JavaScript number (IDs like 8901240544102066246) are kept exact and written as real 64-bit msgpack integers. The resulting Uint8Array is turned into a transport-friendly string: base64 (per RFC 4648) or lowercase hex.

Use base64 when you're embedding the bytes in JSON, an HTTP header, or a database field. Use hex when you're comparing a sample byte-by-byte against the msgpack wire spec or a server log. Same bytes, different rendering.

How to Use the JSON to MessagePack Encoder

Three steps. The conversion runs automatically as you type — no button to click.

1

Paste JSON or Load the Sample

Drop your JSON into the left editor. Hit Sample JSON for a small order payload that exercises the cases that matter — strings, integers, floats, and a nested array. The encoder treats the input as the standard MessagePack type system: integers get the smallest fixint/int8/int16/int32/int64 form, floats become float64, strings get fixstr/str8/16/32 by length, arrays use fixarray/array16/32, and maps use fixmap/map16/32. Example input:

{
  "orderId": "ORD-7421",
  "items": [{ "sku": "SKU-101", "qty": 2 }],
  "total": 89.50
}

This example is 71 bytes as minified JSON (113 pretty-printed) and encodes to 58 bytes of msgpack, about 18% smaller than the minified JSON, before any gzip layer on top.

2

Toggle Hex or Base64

Output format defaults to base64 because that's what you usually paste into a config or send over the wire. Click Hex output to flip to lowercase hex if you're diffing against a server-side encoder or eyeballing the type bytes (e.g. 0x82 for a fixmap of 2). Toggle as often as you want — the underlying bytes are the same.

3

Copy and Ship

Hit Copy to grab the encoded output, or Download if you would rather have it in a text file. Drop it into a Redis SET, a WebSocket text frame, an HTTP body with Content-Type: application/x-msgpack, or a Postgres bytea column (decode the base64 first). To go the other way, paste it into the MessagePack to JSON page.

When You'd Actually Use This

Shrink WebSocket Frames

Real-time apps with chatty per-second updates feel the size difference. A price tick like {"symbol":"ETH-USD","bid":3120.55,"ask":3120.61,...} is 104 bytes as minified JSON and 81 bytes as msgpack. Across thousands of frames per second, that adds up. Convert one sample message here, paste the bytes into your test harness, and check the receiver decodes it the same way.

Pack Cache Values

Caches like Redis charge you for every byte stored and every byte read. Encoding cached objects as msgpack instead of JSON-stringified text shaves storage and network on every hit. Use this page to spot-check what a given object will look like as bytes before you commit to the encoding in your serializer.

Send Typed Numbers

JSON has one numeric type and treats 42 the same as 42.0. MessagePack distinguishes between integer and float on the wire — useful when the receiver is a strongly-typed language like Go, Rust, or C# and you don't want to round-trip through a string. Paste a JSON number and inspect the type byte in hex output to confirm it encoded as an int, not a float.

Debug a Decoder

Got a service that "should" be msgpack but the consumer is choking on the bytes? Encode the same JSON here and compare your service's output byte-for-byte in hex mode. Encoders can legitimately differ in small ways (one might use float32 where this one uses float64), but a different type byte or length prefix on a field usually points straight at the bug.

Common Questions

Does the JSON ever leave my browser?

No. The JSON is parsed by the browser's built-in JSON.parse, encoded by the @msgpack/msgpack library in client-side JavaScript, and rendered as base64 or hex in the right pane — there is no server call, no telemetry on the input, and nothing is logged. You can pop open DevTools and confirm the network tab stays quiet while you type. Safe for proprietary configs and customer data.

Why is the output bigger than I expected?

Two reasons usually. First, base64 inflates the byte count by about 33% — if you compare base64-msgpack to JSON text directly you're not comparing the actual wire size. Switch to hex (which inflates 2x) or, better, look at the byte length: in DevTools, atob(output).length tells you the true size. Second, msgpack only beats JSON when the data has lots of numbers, booleans, or repeated short strings. A blob that's 90% long unique strings will be roughly the same size in either format.

How are integers, floats, and big numbers handled?

Integers are encoded as integers, using the smallest form that fits (fixint, int8, int16, int32 or int64). Numbers with a fractional part become float64. Integers bigger than 2^53, like Snowflake IDs or ICCIDs, would normally be rounded by JSON.parse; this page keeps their exact digits and encodes them as int64/uint64. The one limit: values beyond the 64-bit range don't fit any msgpack integer type, so they're encoded as float64 and lose precision. One more gotcha: 42.0 in your JSON is parsed as the integer 42, so it goes out as an int.

Can I encode binary blobs (like file bytes) with this?

Not directly through JSON, no — JSON has no bin type, so a Uint8Array round-trips through this UI as a base64 string and re-encodes as a msgpack str, not a bin. If you need real msgpack bin or ext types (the two big msgpack-only features), you have to build the object in code and call encode directly with a Uint8Array in place. The JSON pane is for the 90% case where your data is already JSON-shaped.

What's the difference between hex and base64 output?

Both are text spellings of one identical byte sequence. Hex is two characters per byte (so 0x82 becomes the string "82") — useful for reading the spec's type bytes by eye. Base64 is four characters per three bytes per RFC 4648 — denser, and the standard way to embed binary in JSON, JWTs, or HTTP headers. Pick whichever fits where you're pasting the output.

Is msgpack actually faster than JSON, or just smaller?

Smaller is usually the bigger win. On encode/decode speed, modern JSON.parse is so optimized that msgpack ties or only wins by 10-20% in JS. The serialization win shows up downstream: smaller payloads mean less network time and less work for the receiver if it's in a language where parsing JSON costs more than parsing msgpack (looking at you, Python). Quick rule of thumb: pick msgpack if the bottleneck is bandwidth or storage; stick with JSON if it's readability and tooling.

Other MessagePack Tools

Encoding is one direction. These cover the rest of the round-trip: