This is an old version, saved 5 Dec 2026, 05:29 by TechWritereditor. It is the current version.

Base64

Base64 is a binary-to-text encoding that represents binary data as a string of ASCII characters by turning it into a radix-64 (base 64) representation.[1] It lets pictures, documents and other non-text data be stored or sent through systems that, often for historical reasons, accept only US-ASCII text.[2]

Contents
  1. History
  2. How it works
  3. Uses
  4. See also
  5. References

History

The name comes from a content transfer encoding defined for MIME, the standard that lets Email carry attachments and non-English text.[1] RFC 2045, published in November 1996 by Ned Freed and Nathaniel Borenstein, defined the Base64 Content-Transfer-Encoding to represent arbitrary sequences of octets in a form that need not be humanly readable, and required encoded lines of no more than 76 characters.[3] In October 2006 the Internet Engineering Task Force published RFC 4648 by Simon Josefsson, a Standards Track document describing the Base16, Base32 and Base64 encodings, which replaced the earlier RFC 3548.[2]

How it works

Base64 uses an alphabet of 64 characters – the capital letters A–Z, the small letters a–z, the digits 0–9, and "+" and "/" – plus "=" as a padding character.[2] The encoder takes input in groups of 24 bits (three bytes) and splits each group into four 6-bit values, each of which is written as one character.[2] If the final group is shorter, one or two "=" signs are added at the end.[2] Because three bytes become four characters, the encoded data is about 33 per cent larger than the original.[3]

A variant called base64url swaps "+" for "-" and "/" for "_" so that encoded data can safely appear in a Uniform Resource Locator or a file name.[2]

Uses

Common uses include email attachments sent via MIME, storing binary data inside XML, and embedding images or files in data: URLs on web pages.[1] In JavaScript, the btoa() function encodes data to Base64 and atob() decodes it.[1]

See also

References

  1. ^ Base64. MDN Web Docs (Mozilla). developer.mozilla.org
  2. ^ RFC 4648: The Base16, Base32, and Base64 Data Encodings. Internet Engineering Task Force. rfc-editor.org
  3. ^ RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One. Internet Engineering Task Force. datatracker.ietf.org