MessagePack Fixer
Clean up messy MessagePack hex or base64 strings. Strips 0x prefixes, expands \xNN escapes, unwraps Python b'...' literals, and trims paste artifacts.
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. The cleaned result is what a real msgpack decoder — like the official @msgpack/msgpack library or any conforming implementation — will accept without complaint.
Concrete example: paste b'\x83\xa7orderId\xa8ORD-7421...' on the left, hit Clean Up, get the raw hex string on the right that you can drop straight into our MessagePack Viewer or pipe 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.
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.
Click Clean Up
Hit the green Clean Up!! button. The cleanup is click-driven on purpose — you should see what is going 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 we applied so nothing happens silently.
Hand the result to a real decoder
Take the cleaned string from the right pane and drop it into our MessagePack Viewer or MessagePack to JSON tool. If the bytes were genuinely intact and only the formatting was the problem, you will see your decoded JSON — the SKU-101 line items, customer Ava Chen, the whole thing. If the decoder still complains, 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 https://api.example.com | xxd to inspect what the server got. xxd output has line numbers on the left, ASCII on the right, and the hex bytes in the middle with spaces. Strip the address column and ASCII column 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; strips 0x prefixes from each byte; removes inter-byte whitespace and commas. After all that, the result is parsed once as either hex or base64 to confirm it is structurally sound. The notes panel under the editors lists every transformation that actually fired on your input.
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 is auto-detected. If the input is all hex characters (after we strip whitespace, commas, 0x, and \xNN escapes) and even-length, we treat it as hex. Otherwise we try standard base64. Either way, the cleaned output preserves the detected format — clean hex stays hex, 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 — nothing to do. In that case the notes panel shows "Input was already clean." This is normal and good. The fixer is not 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: