base64
Linux · Text · reference only
What it does
Encodes data as Base64 or decodes it. It turns binary content into text that can be copied or sent by email.
Syntax
base64 [opciones] [fichero]
Options and parameters
-dDecodes instead of encoding.
-w columnasWraps the output at that width; 0 disables wrapping.
-iWhen decoding, ignores characters that are not part of the Base64 alphabet.
--helpShows help and exits.
--versionShows the version and exits.
Usage examples
echo -n hola | base64Encodes hola with no trailing newline and returns aG9sYQ==.
echo aG9sYQ== | base64 -dDecodes the text and returns hola.
base64 -w 0 imagen.pngEncodes the file on a single line, with no wrapping.
base64 -d datos.b64 > datos.binRecovers a binary file from its Base64 version.
Notes and common mistakes
- Base64 is not encryption: anyone can decode it, so it does not protect sensitive information.
- With echo without -n the trailing newline is encoded too.