How to use
- Choose Encode to create a uuencoded block, or Decode to recover the data from one.
- Keep the begin and end lines on and enter a file name if the result should work with the uudecode command. Turn them off to get only the data lines.
- Type or paste your input, or open a file to encode its bytes.
- When decoding, paste the whole block including the begin line if there is one, then copy the result or download it as a file.
What is uuencode?
Uuencode, short for Unix-to-Unix encode, dates from around 1980, when files were copied between Unix machines over UUCP links that only carried text. It turns every 3 bytes into four 6-bit values and adds 32 to each, giving printable characters from the space to the underscore. Because mail systems often stripped trailing spaces, the value zero is written as a backtick (`) instead of a space, as this tool does.
A uuencoded file has a fixed layout:
- A header line
begin 644 name, where 644 is the Unix file mode in octal (owner can read and write, everyone else can read) and name is the file to create. - Data lines of up to 45 input bytes. Each starts with a length character (32 plus the byte count, so a full line starts with
M) followed by up to 60 encoded characters. - A line with a single backtick, meaning zero bytes, and then the line
end.
With the length characters and line breaks, the output is about 38% larger than the input.
Uuencode today
Before MIME, uuencode was the usual way to send programs and images by email and to post them on Usenet. MIME Base64 replaced it during the 1990s: uuencode had no way to declare a content type, several incompatible variants existed, and some of its punctuation characters were altered by gateways between ASCII and EBCDIC systems, which is why xxencode was created.
You still meet uuencoded data in mail and news archives, older shell scripts and legacy systems. For new work, use Base64, or File to Base64 for whole files.
Uuencode on the command line and in Python
# Shell (GNU sharutils): input file, then the name for the begin line
uuencode photo.jpg photo.jpg > photo.uu
uudecode photo.uu
# Python: one line of up to 45 bytes at a time
import binascii
line = binascii.b2a_uu(b'hello', backtick=True)
binascii.a2b_uu(line) # b'hello'
Python's old uu module was removed in Python 3.13, but the binascii functions remain.
Specification
| Alphabet | ASCII 32 to 96 (space to `) |
|---|---|
| Output size | About 137% including line prefixes |
| Padding | Lines of up to 45 bytes |
| Standard | POSIX uuencode |
| Case sensitive | Yes |
Examples
| Input (UTF-8) | Output |
|---|---|
Hello, World! | begin 644 data.bin
-2&5L;&\L(%=O<FQD(0``
`
end |
Base64.is | begin 644 data.bin
)0F%S938T+FES
`
end |
你好 | begin 644 data.bin
&Y+V@Y:6]
`
end |
Frequently asked questions
Why does uuencoded text contain backticks?
The value zero would map to a space, and spaces at the end of lines were often lost in transit. Many encoders, including this one, write a backtick instead. The decoder accepts both.
What does begin 644 mean?
It starts the encoded block. 644 is the Unix permission mode for the restored file (read and write for the owner, read for everyone else), and the word after it is the file name that uudecode will create. You can set the name in the options.
Can I decode uuencode without the begin line?
Yes. If there is no begin line, every line is decoded as data. If there is one, decoding starts after it and stops at the end line, so text around the block, such as an email body, is skipped. Trailing spaces removed by mail software are restored automatically.
Is uuencode the same as Base64?
No. Both turn 3 bytes into 4 characters, but uuencode uses a different character range, a length character on each line and begin and end lines. Base64 output cannot be decoded as uuencode or the other way round.