What uuencode does
uuencode (UNIX-to-UNIX encode) was the original way to send binary attachments through plain-text systems like email and Usenet before MIME and Base64 became universal. It converts bytes into printable ASCII and frames them with a begin header that carries file permissions and a name, plus an end trailer.
How it works
The data is processed three bytes at a time. Those 24 bits are split into four 6-bit groups, and each group is turned into a printable character by adding 0x20 (a space). A group of zero is written as the back-tick ` (0x60) to dodge trailing-whitespace issues. Lines hold up to 45 input bytes (60 output characters) and begin with a single length character that also follows the +0x20 rule:
begin 644 message.txt
M1V5R82!Ub V]L<P``
`
end
The leading character of each data line tells the decoder how many bytes that line really represents, so any padding in the last group can be discarded. A final line whose length character decodes to zero ends the data stream.
The begin line: what those numbers mean
The first line of any uuencoded block follows the pattern begin MODE FILENAME.
The mode is a three-digit Unix file permission octet — the same format as
chmod. 644 means the owner can read and write, while group and others can
only read. This mode was meaningful when uuencode was used to reconstruct actual
files on a Unix system; in modern use it is largely a formality, but some decoders
enforce that the mode field is present and numeric.
Why the back-tick instead of a space
The 6-bit value zero maps to ASCII 32, which is a space character. Some email servers and Usenet transport systems stripped trailing spaces from lines, which would corrupt the encoded data in the final group of a line. The uuencode convention is to encode a zero-value group as the back-tick (0x60) instead of a space, since back-ticks survive line-ending cleanup.
uuencode vs Base64: the key differences
Both formats convert binary data to text using a 3-bytes-in, 4-characters-out scheme. The differences are:
- Character set. uuencode uses a contiguous block of ASCII printable characters from space (0x20) to underscore (0x5F), shifted by adding 0x20 to each 6-bit value. Base64 uses a carefully chosen 64-character alphabet (A–Z, a–z, 0–9, +, /) that avoids special characters.
- Per-line length prefix. uuencode prefixes each data line with a character encoding how many bytes that line represents. Base64 has no such structure.
- Framing. uuencode wraps the data in
begin/endwith filename and mode. MIME Base64 uses aContent-Typeheader for metadata.
When you still encounter uuencode today
uuencode is effectively obsolete for new systems — MIME and Base64 have replaced it entirely in email and HTTP. However, it still appears in:
- Legacy Usenet archives. Decades of binary newsgroup posts (software, images, patches) were shared via uuencode. Decoding archived posts requires uudecode.
- Old source archives. Some Unix software distributions from the 1980s and 1990s shipped with embedded uuencoded binary components in shell scripts.
- Embedded scripts. Occasionally a shell script will bundle a small binary blob in uuencode format to avoid external file dependencies.
Tips
This tool encodes the UTF-8 bytes of whatever text you type and produces a
complete, copy-pasteable uuencode document. When decoding, it skips the
begin/end framing automatically and honours the per-line length byte, so it
interoperates with output from the classic uuencode command. Decoded bytes are
interpreted as UTF-8 text, so non-text payloads may not render cleanly.