UUEncode / UUDecode

Classic Unix-to-Unix email attachment encoding, in your browser

Free uuencode and uudecode tool implementing the classic Unix-to-Unix encoding with begin header, length-prefixed lines and the standard 6-bit-plus-0x20 alphabet. Encode text to a uuencoded block or decode one back, client-side. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What does the begin line mean?

The header line reads begin 644 filename. The 644 is the Unix file permission in octal (owner read-write, group and others read-only) and filename is the original name. uudecode uses these to recreate the file with the right name and mode.

UUEncode is the original Unix-to-Unix encoding that let people email or post binary files across systems that only passed 7-bit text. It predates MIME base64 and you still find uuencoded blocks in old archives and Usenet. This tool encodes text into a proper uuencoded block with header and trailer, and decodes such blocks back to the original bytes, all in your browser.

How it works

A uuencoded stream starts with a header line begin 644 filename, where 644 is the octal file mode and the name is preserved for the decoder. The body encodes the data in lines of up to 45 source bytes. For each group of three bytes (24 bits), uuencode produces four characters by chopping the 24 bits into four 6-bit values and adding 0x20 to each, mapping 0-63 onto printable ASCII. Every line begins with one more character that encodes the line’s source-byte count, so the decoder knows how many bytes to keep when the last group is padded.

The block ends with a line containing a single zero-length marker followed by end. To stay safe in email, a 6-bit value of zero is written as a backtick rather than a literal space; this tool emits and accepts that form.

The format in detail

A complete uuencoded file looks like this:

begin 644 hello.txt
+2&5L;&\@=V]R;&0*
`
end

Breaking that down:

  • begin — signals the start of a uuencoded block.
  • 644 — the Unix file permission in octal (owner: read+write; group: read; others: read). The uudecode command uses this to restore the file with the right permissions.
  • hello.txt — the filename to be recreated by the decoder.
  • The encoded line(s) — each starts with a length character (here + = 11 source bytes) followed by the 6-bit encoded data.
  • The backtick-only line — encodes a line of zero source bytes, signaling end of data.
  • end — signals the end of the block.

UUEncode versus Base64 — understanding the difference

Both UUEncode and Base64 solve the same problem: turning binary bytes into printable ASCII for transport over 7-bit channels. They differ in their alphabet and structure:

FeatureUUEncodeBase64
Alphabet rangeASCII 0x20–0x5FA-Z, a-z, 0-9, +, /
Characters per group4 chars per 3 bytes4 chars per 3 bytes
Line structureLength-prefixed lines of up to 45 bytes64-char lines, no length prefix
Header / trailerbegin/end with filename and modeNone (framing handled by MIME)
PaddingBacktick for zero-value 6-bit groups= padding

Base64 won out in modern email (through MIME) because its alphabet avoids characters that email gateways sometimes transform. UUEncode’s use of characters like ~, {, and } caused problems on some mail systems that modified those bytes.

When you will still encounter UUEncode

UUEncode is a legacy format but it is not extinct. You find it in:

  • Old Usenet archives and newsgroup binaries — before modern binary newsgroups standardized on yEnc, uuencode was the dominant posting format. The Internet Archive and other historical newsgroup mirrors contain millions of uuencoded files.
  • Unix shell scripts from the 1980s–2000s — some system administration scripts self-contained binary data as uuencoded blocks so a single text file could be distributed and then extracted.
  • Old email archives — corporate email archives from the pre-MIME era often contain attachments as uuencoded blocks inline in the message body.
  • Certain embedded and firmware files — some embedded systems use uuencode to bundle calibration data or certificates in plain text configuration files.

Tips for decoding real messages

If you are decoding a real message, paste everything from the begin line through end. The tool ignores anything before begin, so surrounding email headers are harmless. Watch for two common issues:

  1. Line-wrapping damage — if an email client re-wrapped the lines, the length-encoded line structure will be corrupted. Try to get the original raw message source rather than a forwarded copy.
  2. Missing end line — some tools that extracted only the body may have omitted the end line. The decoder will usually still work if the backtick zero-length line is present.

For new work prefer MIME base64 or Quoted-Printable. Use uuencode only for reading or generating legacy payloads that require the format.