Blog
Custom Print on Demand Apparel — Free Storefront for Your Business
Wild & Free Tools

Base64 Decode on Linux, Mac, and Windows — Command Line Guide

Last updated: April 20267 min readEncode/Decode Tools

Every OS has a built-in way to decode Base64 from the terminal. The syntax is slightly different on each. Here is the exact command for every platform, plus a browser alternative when you do not want to open a terminal.

Linux

The base64 command is pre-installed on every major distro.

The -n flag on echo is important when encoding. Without it, echo adds a trailing newline that gets included in the Base64 output.

macOS

macOS uses the BSD version of base64. The critical difference: use -D (capital) for decode, not -d.

If you use Homebrew and install coreutils, you get gbase64 which uses the same flags as Linux (-d for decode).

Windows

Windows does not have a simple base64 command.

PowerShell

Verbose, but it works. PowerShell 5+ is pre-installed on Windows 10 and 11.

CMD (certutil)

Only works with files, not inline strings. And the output includes a certificate header/footer that you may need to strip.

Quick Reference

PlatformDecode CommandGotcha
Linuxecho "..." | base64 -dUse -n on echo when encoding
macOSecho "..." | base64 -DCapital -D, not lowercase -d
PowerShell[Convert]::FromBase64String(...)Verbose syntax
CMDcertutil -decode file.txt out.txtFiles only, adds headers
Pythonbase64.b64decode("...").decode()Works everywhere Python runs
BrowserPaste and click DecodeNo syntax to remember

When the Command Line Is Overkill

If you need to quickly decode one string while reading documentation, debugging an API response, or checking a Kubernetes secret, opening a terminal and typing a command is slower than opening a browser tab.

The Base64 Encoder/Decoder handles both encoding and decoding with one click. No syntax differences between platforms, no flags to remember, full UTF-8 support built in.

Skip the terminal. Decode Base64 in one click.

Open Decoder →

Scripting and Automation

For scripts and CI/CD pipelines, the command-line tools are the right choice. Some tips:

Related: URL Encoder for percent-encoding, JSON Formatter for API debugging.

Launch Your Own Clothing Brand — No Inventory, No Risk