← 返回命令列表

Linux command

base64 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Encode

base64 [file]

Decode

base64 -d [file.b64]

Example

echo [text] | base64

Example

echo [ENCODED] | base64 -d

No wrapping

base64 -w 0 [file]

说明

base64 encodes and decodes data using base64 encoding. Base64 represents binary data using 64 printable ASCII characters, making it suitable for transmitting binary data over text-only channels like email or JSON. The tool is part of GNU coreutils and widely used for encoding credentials, certificates, and binary data in configuration files.

参数

-d, --decode
Decode base64 data
-i, --ignore-garbage
Ignore non-alphabet characters when decoding
-w, --wrap=_cols_
Wrap lines at specified width (default: 76, 0 = no wrap)

FAQ

What is the base64 command used for?

base64 encodes and decodes data using base64 encoding. Base64 represents binary data using 64 printable ASCII characters, making it suitable for transmitting binary data over text-only channels like email or JSON. The tool is part of GNU coreutils and widely used for encoding credentials, certificates, and binary data in configuration files.

How do I run a basic base64 example?

Run `base64 [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -d, --decode do in base64?

Decode base64 data