# info > base64

---
type: CommandReference
command: base64
mode: info
section: "3.6"
source: coreutils
---

## Quick Reference

- `base64 FILE` — encode file to base64, output to stdout
- `base64 --decode FILE` — decode base64 file back to original
- `base64 -w 0 FILE` — encode without line wrapping
- `base64 -i --decode FILE` — decode ignoring garbage characters
- `echo "text" | base64` — encode stdin

## Name

Transform data into printable data (base64 encoding/decoding).

## Synopsis

shell
base64 [OPTION]... [FILE]
base64 --decode [OPTION]... [FILE]
## Options

- `-w COLS`, `--wrap=COLS` — wrap encoded lines after `COLS` characters (default 76; use 0 to disable wrapping)
- `-d`, `--decode` — change mode from encoding to decoding
- `-i`, `--ignore-garbage` — when decoding, ignore unrecognized bytes (newlines always accepted)

## Examples

shell
# Encode a file
base64 myfile.bin

# Decode a base64 file
base64 --decode encoded.txt

# Encode without line wrapping
base64 -w 0 myfile.bin

# Decode while ignoring garbage
base64 -i -d messy.txt

# Encode standard input
echo "Hello, world!" | base64
## See Also

- [base32](coreutils.html#base32)
- [basenc](coreutils.html#basenc)
- RFC 4648 (https://tools.ietf.org/search/rfc4648)

## Exit Codes

- **0** — success
- **nonzero** — failure