Ascii85 Encoder / Decoder
Convert text to and from Ascii85.
Result
How it is calculated
Encoding reads the text as bytes and takes them in groups of 4. Each group is read as one 32-bit number n = b0·256³ + b1·256² + b2·256 + b3, which is written in base 85 as five digits; each digit d becomes the character with code d + 33, so the output uses the printable characters from ! to u. As PDF 32000-1 (7.4.3) specifies, a full group of four zero bytes is written as z instead of !!!!!. A last group of r bytes (fewer than 4) is padded with zero bytes and only the first r + 1 characters are kept, never as z. The output has no delimiters. Decoding reverses this: white space is ignored, a z between groups gives four zero bytes, the ~> end-of-data marker ends the data, characters are read in groups of 5, and a short last group is padded with u. Input is rejected, as the standard requires, if it has a character outside ! to u and z, a z inside a group, a group worth more than 2³² − 1, or a last group of one character. Non-ASCII letters take several bytes, so they give more characters.
Worked example
Encode Hello, World!, 13 bytes. The first group Hell is the number 1,214,606,444. In base 85 its digits are 23, 22, 66, 52, 49; adding 33 gives the characters 87cUR. The next groups o, W and orld are converted the same way, and the final single byte ! gives two characters. The full result is 87cURD_*#4DfTZ)+T, 18 characters for 13 bytes. Switching the mode to decode and pasting the result returns Hello, World!.
Common mistakes
- Pasting Ascii85 with the
<~opening marker that some PostScript tools add. The closing~>is understood, but remove the<~first. - Expecting
!!!!!for four zero bytes. The encoder writesz, as the PDF standard does; both decode the same. - Leaving the mode on encode when the text is already Ascii85. It is then encoded a second time, giving longer, different text.
- Copying only part of an encoded string. A missing character changes the group alignment, and the output is garbled or empty.
- Treating Ascii85 as encryption. It is only a reversible encoding that anyone can decode.
Sources
About this calculator
This calculator encodes text to Ascii85 (base85) or decodes it back, using the scheme that packs every 4 bytes of binary data into 5 printable ASCII characters — more space-efficient than Base64's 4-for-3 ratio, at the cost of a wider character set. It follows the ASCII85Decode filter of the PDF standard (ISO 32000-1, 7.4.3): a group of four zero bytes is written as the single character z, and when decoding, white space is ignored and the ~> end-of-data marker ends the input.
Developers working with PDF and PostScript files, where Ascii85 is a native filter, and anyone needing compact text-safe binary encoding, use it to embed binary data in text-only formats.
Was this helpful?
You can pick up to 3 reactions.
Comments
- Be the first to comment.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm's Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Note from the editors
As a size check, the 13-byte string Hello, World! becomes 17 characters here, four more than the input, whereas Base64 would need 20. Runs of zero bytes shrink further, because each group of four zeros is written as a single z, as the PDF standard specifies. The output uses punctuation that can break in URLs, JSON or shell strings. Which Ascii85 variant do you work with?