COBS encode
COBS encode. Runs on your device, nothing is uploaded.
Runs on your device. The file is never uploaded.
COBS encode removes every zero byte from a file, splitting it into runs and putting a length prefix in front of each one. A run also ends after 254 non-zero bytes, since a prefix cannot count higher. The bytes print as space-separated lowercase hex, and the trailing zero that ends a frame is not appended.
Questions
What problem does COBS solve?
It removes zero bytes from a block of data so a single zero can be used as an unambiguous packet delimiter on a serial link or in a byte stream. After encoding, the data contains no zero byte anywhere, so a receiver can resynchronise simply by scanning for the next zero.
Why is the output shown as hex?
Because the point of COBS is the byte stream itself, and most of its bytes are not printable. The tool prints the encoded bytes as space-separated lowercase hex pairs so you can read the length prefixes. Feed that text to From hexdump if you want the real bytes in a file.
Does it add the trailing zero delimiter?
No. It emits the encoded block only. The zero byte that marks the end of a frame is a framing decision, so append 00 yourself when you write the packet out. Nothing in the encoded block will collide with it.
How much does it add to my data?
One byte for the first block, plus one more each time a block ends. A block ends at every zero byte in your input and also after 254 non-zero bytes, since a length prefix cannot count higher. So data with no zeros costs one byte per 254, and worst case is one byte per zero.
Is this COBS/R or some framing protocol?
Plain COBS. There is no reduced variant, no CRC, no header and no escape processing beyond the byte stuffing itself. Framing, checksums, retries and any length field around the block are yours to add. The one guarantee you get is that the encoded bytes contain no zero anywhere.
Does the data go anywhere?
No. The stuffing runs in a Web Worker in this tab, with no server and no storage of any kind. The page also works offline after the first load, which is useful when you are debugging a device on a bench machine that has no network connection at all.