Run-Length Encoding
Run-Length Encoding (RLE) compresses a string by replacing each run of identical consecutive characters with the character and its count — AAAABBBCCD becomes 4A3B2C1D (count-then-char). This tool encodes and decodes, using a count-then-char scheme that is an exact round-trip for any text that does not itself contain digits. Decode reverses it back to the original. Useful for teaching the simplest lossless compression and for compressing data with long runs. Runs locally in your browser.
Input
Result
Encoding: each maximal run of one character is written as its decimal length followed by the single character — AAAA → 4A. A run of length 1 is written 1A (the count is always present, which keeps decode unambiguous). Decoding: read a run as a number (one or more digits) immediately followed by exactly one character, then repeat that character that many times. Because the count is always a maximal digit-run and the symbol is exactly one character, the only ambiguity would be a symbol that is itself a digit — so the input to encode may not contain the digits 0–9 (a run like 1111 could otherwise not be round-tripped). Newlines and any other non-digit characters are fine. Round-trip: decoding an encoded string always reproduces the original; the tool verifies this and shows both sizes. Pairs with the Base64 and Gzip tools. Everything runs locally — nothing leaves your browser.