Forrest logo
back to the base64 tool

base64:tldr:643d8

base64: Encode the contents of a file as base64 and write the result to `stdout`.
$ base64 ${filename}
try on your machine

The command "base64 ${filename}" is used to encode a file into the Base64 format.

Here's how it works:

  1. "base64" is the command-line program used to encode data in Base64 format. It is commonly available on Unix-like systems, including Linux and macOS.

  2. "${filename}" is a placeholder that represents the name of the file you want to encode. You need to replace "${filename}" with the actual name and path of the file you want to encode.

When you execute this command, the "base64" program reads the specified file and converts its contents into Base64 format. The encoded output is then printed to the standard output (usually the terminal). The Base64 format represents binary data, such as a file, using a set of 64 ASCII characters.

You can redirect the output to a file if you want to save the encoded result. For example, if you want to save the encoded output in a file called "encoded.txt", you can use the following command:

base64 ${filename} > encoded.txt

Keep in mind that when you want to decode the Base64-encoded data back to its original form, you'll need to use a decoding command or program, such as "base64 -d".

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the base64 tool