The value of this property specifies the default encoding method
for the DecodeFile and EncodeFile methods. Unless
needed for a specific purpose, it is strongly recommended that binary
files be encoded with the Base64 algorithm for maximum compatibility.
It is not necessary to use this control to encode or decode
file attachments with the
Mail Message control,
since it automatically handles encoding and decoding multipart messages.
If you wish to convert the contents of a text file to a different
Unicode encoding, use the ConvertFile method.
Base64
Base64 is the most commonly used encoding scheme for converting
binary data into a text format. It encodes data in blocks of 3 bytes
into 4 printable ASCII characters using a well-defined 64-character
alphabet. This method is efficient and highly compatible with a wide
range of systems, including email clients, web browsers, APIs, and
storage systems that expect text input. The Base64 algorithm includes
padding to ensure the output is always a multiple of four characters,
which helps with alignment and parsing. It is ideal for encoding
attachments, configuration files, cryptographic hashes, and any other
binary data where compactness and compatibility are important. Base64
is also significantly faster than more complex schemes like Base58,
and should be used whenever performance and size efficiency are
important, particularly when encoding large files or data streams.
Base58
Base58 is a binary-to-text encoding scheme designed to represent
binary data in a compact, human-readable format. It is most commonly
known for its use in cryptocurrency applications, particularly Bitcoin
addresses. Unlike Base64, which uses a fixed-length representation and
padding, Base58 avoids visually similar characters and does not
include padding. The Base58 alphabet omits the characters 0
(zero), O (capital o), I (capital i), and
l (lowercase L) to reduce the risk of confusion when
viewing or entering an encoded string.
Base58 encodes data by interpreting it as a large integer and as
a result, the byte order matters. In typical Base58 usage (e.g., Bitcoin),
the input is treated as a big-endian number where the most significant
byte comes first. This affects how the data is divided and converted
to Base58 digits during encoding. However, not all implementations
follow this convention. Some online tools or libraries may treat
input as little-endian (least significant byte first), leading to
different encoded outputs for the same binary data. Both decode to the
same binary value and are valid, but they are not interchangeable.
Important: Never use Base58 to encode large files. While
Base58 is excellent for encoding small identifiers or hashes, it is
not designed for high-performance or large-scale encoding. Base58
encoding is significantly slower than Base64 because it does not
operate on fixed-size blocks and requires arbitrary-precision
arithmetic with repeated division and modulo operations. If the file
is more than a few kilobytes, you should use the Base64 algorithm
for encoding.
Base32
Base32 is a text encoding scheme that represents binary data using a
set of 32 alphanumeric characters (A–Z and 2–7). It is designed to be
case-insensitive, making it suitable for environments where case
preservation is unreliable, such as DNS records, QR codes, and certain
user-facing identifiers.
Unlike Base64, Base32 uses only uppercase letters and digits, avoiding
symbols and padding characters that might be problematic in legacy systems.
This makes it easier to transcribe or read aloud, and less prone to
corruption when copied manually. However, the tradeoff is reduced efficiency
because Base32 requires more characters to encode the same amount of data.
Specifically, it encodes every 5 bytes of input as 8 characters of output,
resulting in roughly a 60% size increase.
Base32 is useful when binary data must be represented in a constrained
character set and the encoded string may be used in contexts that
ignore case or disallow punctuation. Examples include secret keys for
two-factor authentication (TOTP), unique file identifiers, or human-readable
hash values. For general-purpose file encoding, Base64 remains the preferred
format due to its higher efficiency and broader adoption.
Base85
Base85 is a high-efficiency binary-to-text encoding method that
encodes every 4 bytes of binary data into 5 ASCII characters. Compared
to Base64, it provides a more compact representation of binary data,
increasing output size by only ~25% rather than 33%. This makes Base85
particularly useful in bandwidth-sensitive applications or when
embedding binary data into text files.
The Base85 alphabet includes a wide range of printable ASCII
characters, avoiding control characters and whitespace. Unlike
Base64, Base85 does not use padding and encodes data in fixed-length
4-byte blocks. Any remaining bytes at the end of the input are
encoded using special logic to maintain compactness.
Base85 is an excellent choice when both compactness and full ASCII
compatibility are important. It is faster and more efficient than Base58
for larger files, and often preferred over Base64 in advanced document
formats and embedded applications. However, due to the expanded character
set, it may be less readable and harder to work with manually than Base32
or Base64. For general use, Base64 remains the best compromise between
readability, efficiency, and compatibility.
Uuencode / Uudecode
Uuencode (Unix-to-Unix encode) is a legacy encoding format
originally developed for transmitting binary files over systems that
only supported 7-bit ASCII text, such as early UNIX-based email and
file transfer systems. It encodes binary data into lines of
printable characters, including a header line that specifies file
permissions and a filename. The corresponding uudecode tool can
extract and reconstruct the original file from this format.
Although largely obsolete today, uuencode remains useful for
compatibility with older systems, embedded environments, and some
command-line tools. However, it is less space-efficient than modern
alternatives like Base64 and lacks support for Unicode or MIME
encoding standards.
Quoted-Printable Encoding
Quoted-printable is a MIME-compliant encoding scheme designed for
encoding data that is mostly ASCII text but may contain a few
non-printable or special characters. It represents such characters
as =XX, where XX is the two-digit hexadecimal value of the byte.
Line breaks and spaces at the end of lines are also handled
carefully to preserve formatting across different systems.
Quoted-printable is ideal for encoding email content in ISO-8859-1
or UTF-8 where text needs to remain mostly readable while ensuring
it passes through 7-bit transport layers. It is not efficient for
arbitrary binary files, as it may significantly increase the size of
the encoded output when many bytes require escaping.
yEnc Encoding
yEnc is a compact binary-to-text encoding format developed as an
improvement over uuencode for posting files to Usenet newsgroups. It
provides much better space efficiency (only ~1-2% overhead compared
to 33% for Base64 or uuencode) and supports 8-bit clean encoding
using simple transformations. yEnc files typically include headers
and checksums to support multipart files, resume downloads, and
error detection. Although it is not a formal Internet standard, yEnc
is widely supported by Usenet clients and utilities that deal with
large binary file transfers over NNTP. It is best suited for large
attachments or downloads over older protocols that favor plain text.