The base64 Command-Line Tool
Encode raw data using the base64 algorithm or decode base64-encoded data back to its raw representation.
Usage
base64 {subCommand} {arguments}
This tool uses subcommands to indicate which function you want to perform.
Jump to a list of the available subcommands.
Global Arguments
-
--interactive — Launch the tool in interactive mode.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
-H / --help — Display usage information for this program.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
--help-subcommands — Display the names and descriptions of the supported subcommands.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
--help-debug — Display usage information for debug logging.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
--enable-debug-logging — Enables debug logging for the tool.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
--debug-log-level {level} — The debug log level to use for the tool. Allowed values include 'off', 'severe', 'warning', 'info', 'fine', 'finer', and 'finest'. If this is not specified, a default level of 'severe' will be used.
-
--debug-log-category {category} — The message categories to include in the debug log output. Allowed values include 'asn1', 'connect', 'exception', 'ldap', 'connectionpool', 'ldif', 'monitor', 'codingerror', and 'other'. This argument may be provided multiple times to indicate that multiple categories should be included. If this is not specified, then all categories will be included.
-
--include-debug-stack-traces — Indicates that debug log messages should include a stack trace with the code location from which each debug message originated.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
--use-multi-line-debug-messages — Indicates that debug log messages (which will be JSON objects) should be written as multi-line strings rather than single-line strings.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
--debug-log-file {path} — The path to the debug log file to be written. If this is not specified, a default path of 'base64.debug' will be used.
The specified path must refer to a file which may or may not exist, but whose parent directory must exist.
-
-V / --version — Display version information for this program.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
--propertiesFilePath {path} — The path to a properties file used to specify default values for arguments not supplied on the command line.
The specified path must refer to a file that exists.
-
--generatePropertiesFile {path} — Write an empty properties file that may be used to specify default values for arguments.
The specified path must refer to a file which may or may not exist, but whose parent directory must exist.
-
--noPropertiesFile — Do not obtain any argument values from a properties file.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
--suppressPropertiesFileComment — Suppress output listing the arguments obtained from a properties file.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
Exclusive Argument Sets
-
The following arguments cannot be used together: --propertiesFilePath, --noPropertiesFile
Examples
- Base64-encodes the string 'Hello' and writes the result to standard output.
base64 encode --data Hello
- Base64-decodes the data contained in the 'encoded-data.txt' file and writes the result to the 'raw-data.txt' file.
base64 decode --inputFile encoded-data.txt --outputFile decoded-data.txt
-
encode — Base64-encodes raw data.
-
decode — Decodes base64-encoded data.
Base64-encodes raw data.
Arguments
-
-d {data} / --data {data} — The raw data to be encoded. If neither the --data nor the --inputFile argument is provided, then the data will be read from standard input.
-
-f {path} / --inputFile {path} — The path to a file containing the raw data to be encoded. If neither the --data nor the --inputFile argument is provided, then the data will be read from standard input.
The specified path must refer to a file that exists.
-
-o {path} / --outputFile {path} — The path to a file to which the encoded data should be written. If this is not provided, the encoded data will be written to standard output.
The specified path must refer to a file which may or may not exist, but whose parent directory must exist.
-
--url — Encode the data with the base64url mechanism rather than the standard base64 mechanism.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
--ignoreTrailingLineBreak — Ignore any end-of-line marker that may be present at the end of the data to encode.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
Exclusive Argument Sets
-
The following arguments cannot be used together: --data, --inputFile
Examples
- Base64-encodes the string 'Hello' and writes the result to standard output.
base64 encode encode --data Hello
- Base64-encodes the data contained in the 'raw-data.txt' file and writes the result to the 'encoded-data.txt' file.
base64 encode encode --inputFile raw-data.txt \
--outputFile encoded-data.txt
- Base64-encodes data read from standard input and writes the result to standard output.
base64 encode encode
Decodes base64-encoded data.
Arguments
-
-d {data} / --data {data} — The base64-encoded data to be decoded. If neither the --data nor the --inputFile argument is provided, then the data will be read from standard input.
-
-f {path} / --inputFile {path} — The path to a file containing the base64-encoded data to be decoded. If neither the --data nor the --inputFile argument is provided, then the data will be read from standard input.
The specified path must refer to a file that exists.
-
-o {path} / --outputFile {path} — The path to a file to which the decoded data should be written. If this is not provided, the decoded data will be written to standard output.
The specified path must refer to a file which may or may not exist, but whose parent directory must exist.
-
--url — Decode the data with the base64url mechanism rather than the standard base64 mechanism.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
-
--addTrailingLineBreak — Add a line break to the end of the decoded data.
This argument is not allowed to have a value. If this argument is included in a set of arguments, then it will be assumed to have a value of 'true'. If it is absent from a set of arguments, then it will be assumed to have a value of 'false'.
Exclusive Argument Sets
-
The following arguments cannot be used together: --data, --inputFile
Examples
- Base64-decodes the string 'SGVsbG8=' and writes the result to standard output.
base64 decode decode --data SGVsbG8=
- Base64-decodes the data contained in the 'encoded-data.txt' file and writes the result to the 'raw-data.txt' file.
base64 decode decode --inputFile encoded-data.txt \
--outputFile decoded-data.txt
- Base64-decodes data read from standard input and writes the result to standard output.
base64 decode decode