Encodes and decodes base64 data streams (by upload or direct input).
This online tool encodes binary data into a base64 string or decodes a base64 string into the binary representation. You can enter data to be encoded/decoded by uploading a file or directly into the textarea below. Encoded base64 data can be split in lines each 76 chars long.
Implementation uses PHP's base64 functions which in turn comply to the RFC 2045 standard. ¶
Base64 is a commonly used method for representing datastream that may contain bytes with any values into a stream of bytes that look like Latin characters (a-z), digits (0-9) and 3 special characters (/ + =).
Base64 is mostly used to convert binary data into text representation which can be safely transmitted over the network through services which might damage it in its raw form. For example, early e-mail applications attempted to convert incoming messages into receiver's character set which would most probably corrupt binary. ¶
Иase64 algorithm is actually simple to understand: input stream is processed in 3-byte chunks, each chunk (8 * 3 = 24 bits) is divided into 4 smaller «bytes» (6 bits in each). Then since max possible value for a 6-bit number is 64 we only need 64 symbols to represent it. This is what base64 (and its other variations) do: each value from 0 to 63 is assigned a symbol (in this order: A-Z, a-z, 0-9, +, /) and then output.
This way output stream is always ~33% larger than the original (4 / 3 ~1.33). ¶
Besides base64 there are other encodings used for similar purpose – like uuencode (originating from an Unix mail client) or URL encoding (also called percent-encoding, generally very inefficient).
However, base64 is generall a best choice and is widely used. ¶
There also are variations of base64 itself: ¶
Apart from these there are near a dozen of base64 standards for different environments (for example, in XML or OpenPGP) – you can see the list at this Wikipedia article.
The tool on this page uses PHP's base64 functions which in turn comply to the RFC 2045 standard. ¶