Paste a messy MessagePack hex or base64 string here, then click "Clean Up"Paste messy msgpack

What the MessagePack Fixer Actually Does

Be honest with yourself for a second: MessagePack is a binary format. If a few bytes got truncated when you copy-pasted out of a Cloudflare Worker log, no tool can magic them back — those bytes are gone, and the spec at github.com/msgpack/msgpack is length-prefixed enough that a missing tail will fail to decode no matter what you do. So this page does NOT pretend to repair corrupt binary data.

What it DOES is something more boring but useful: it strips the formatting noise that hex and base64 (RFC 4648) dumps pick up on the way through your terminal, your debugger, your iOS console, and your clipboard. Concretely, it trims surrounding whitespace, peels off wrapping quotes, unwraps Python b'...' byte literals, expands \xNN escape sequences into raw hex digits, removes 0x prefixes, and drops commas and whitespace from inside the payload. Then it runs the cleaned bytes through the @msgpack/msgpack decoder once and tells you in the notes whether they decode. If they don't, you know the problem is in the bytes, not the formatting.

Concrete example: paste b'\x83\xa7orderId\xa8ORD-7421...' on the left, hit Clean Up, and get the raw hex string on the right that you can drop straight into the MessagePack Viewer or turn into a Uint8Array in a quick Node REPL. Nothing fancy. Just removing the noise.

How to Clean Up a Pasted MessagePack String

Three steps. Built for the moment when you have just copied something out of a log line and want it to be hex you can hand to a decoder.

1

Paste the messy string into the left pane

Drop whatever you have into the left editor — a Python repr(), an iOS device console line, the output of curl --data-binary @file | xxd, a Cloudflare Worker log entry, anything. The fixer does not need it to look pretty going in. Hit Sample messy hex for a deliberately ugly example with prefixes and escapes mixed in. Example of what you might paste:

b'\x83\xa7orderId\xa8ORD-7421\xa5items\x92\x82\xa3sku\xa7SKU-101\xa3qty\x02\x82\xa3sku\xa7SKU-244\xa3qty\x01\xa8customer\xa8Ava Chen'

That is a real Python byte literal printed by msgpack-python. The fixer recognises the b'...' wrapper, peels it off, and turns each \xNN into raw hex.

2

Click Clean Up

Hit the green Clean Up button. The cleanup is click-driven on purpose: you should see what goes in before you accept what comes out. The right pane shows the cleaned hex (or Base64, auto-detected), and the notes panel below the editors lists every transformation applied, plus whether the result decodes as MessagePack.

3

Hand the result to a real decoder

Take the cleaned string from the right pane and drop it into the MessagePack Viewer or MessagePack to JSON tool. If the bytes were intact and only the formatting was the problem, you'll see your decoded JSON: the SKU-101 line items, customer Ava Chen, the whole thing. If the notes already warned that the bytes don't decode, the issue is real corruption or truncation, and the only fix is to grab the bytes again from the source.

When You Will Actually Use This

Lift bytes out of a Cloudflare Worker log

Workers love to log binary payloads as 0x83 0xa7 6f 72 64 65 72... with spaces between bytes and 0x on every one. Copy the line, paste it here, and the fixer strips the prefixes and the spaces in one click — leaving you with 83a76f7264657249... which a real decoder will eat.

Unwrap a Python repr from a debugger

You hit a breakpoint in pdb, ran p msgpack.packb(order), and got back b'\x83\xa7orderId\xa8ORD-7421'. That is a Python byte literal — the b prefix and the quotes are not part of the data. The fixer peels them off and expands every \xNN into the actual hex pair, so you can paste the result into the viewer without rewriting it by hand.

Clean up a curl --data-binary | xxd dump

You ran curl --data-binary @msg.bin "$API_URL/orders" | xxd to inspect what the server got. xxd output has offsets on the left, ASCII on the right, and the hex bytes in the middle with spaces. Strip the offset and ASCII columns yourself, paste the middle into the fixer, and it removes the inter-byte spaces so the hex is one solid string again.

Paste from an iOS device console

iOS console output sometimes wraps a binary payload in single quotes and inserts soft line breaks. The fixer handles the surrounding quotes and the whitespace in one pass, which saves you from playing find-and-replace in a text editor before you can decode anything.

Common Questions

Can this tool repair corrupt MessagePack binary data?

No, and you should be suspicious of any tool that claims it can. MessagePack is a binary, length-prefixed format — if a byte is missing or wrong in the middle of a length field, the decoder cannot guess what was supposed to be there. This page only fixes paste artifacts and formatting noise. If your bytes are actually corrupt, the fix is to grab them again from the source: re-run the request, re-read from the log retention store, re-export from the database. There is no software substitute for the missing bytes.

What exactly does "clean up" mean here?

Six concrete normalizations: trims surrounding whitespace; peels off wrapping single or double quotes; unwraps Python b'...' / b"..." byte literals; expands \xNN escape sequences into raw hex digits (including redis-cli style strings that mix escapes with plain text); strips 0x prefixes from each byte; removes inter-byte whitespace and commas. After that, the bytes are run through a MessagePack decoder once. The notes panel lists every transformation that fired and says whether the result decodes. Cleaning never changes the bytes themselves.

Why is there a Clean Up button instead of auto-cleaning as I type?

On purpose. Most of our other tools auto-update on input change because the input is human-readable and you want instant feedback. This one is the opposite — the input is a pile of escape sequences and your goal is to verify what got transformed before you trust the output. Click-driven means you can paste, look at the input, click, and then read the notes panel to confirm we did what you expected.

Does my data leave the browser?

No. The whole cleanup runs locally in this tab. There is no fetch, no upload, no telemetry on the input. Close the tab and the data is gone. That said, treat the URL bar like a public space — do not paste payloads with secrets into a query string, and clear your clipboard if it carried something sensitive after you are done.

What if my input is base64 instead of hex?

It's auto-detected. If the input is all hex characters (after stripping whitespace, commas, 0x and \xNN escapes) and even-length, it's treated as hex. Otherwise it's tried as standard Base64, and URL-safe Base64 (- and _) is converted to standard Base64. Clean hex stays hex and clean Base64 stays Base64. Drop the result into the MessagePack Viewer next, which auto-detects the same way.

Why does the output sometimes look identical to the input?

Because your input was already clean, so there was nothing to do. In that case the notes panel says the input was already clean and whether it decodes. That's normal. The fixer isn't going to invent transformations just to look busy.

Other MessagePack Tools

Cleaning up the formatting is the first step. Once the string is clean, these decode and round-trip the bytes: