Skip to content
86% off$349 $48.86code BF2026

Guides

AI Gave Me a Base64 Command for Terminal: Decode It First

An AI gave you a base64 blob to run in Terminal? Decode it to the screen first, read it, and never pipe it to a shell. Exact Mac commands and a checklist.

GuideUpdated 7 min read

On this page

You asked an AI assistant (Grok, Cursor, ChatGPT or another) for a fix, and one of the commands came back with a long string of random-looking characters. Something like "echo '...' | base64 -d | bash". People on sysadmin forums describe the same reaction: a sudden base64 blob in a server fix looks alarming. Their replies are consistent: base64 is a common way to carry a script on one line, and it is trivial to see what is inside, so do that first.

Why a base64 blob in a command is a red flag (and when it is normal)

Base64 is an encoding, not encryption. It turns bytes into plain letters, digits, +, / and = so that a multi-line script or a file can travel in one line without quoting problems. That is a legitimate reason for an assistant to use it.

The same property hides intent. You cannot read the blob by eye, so you cannot tell whether it restarts a service or downloads something else. A command you can't read is one you shouldn't run, especially as root on a server such as a WHM/cPanel host.

The dangerous shape decodes the blob and hands the result straight to a shell:

Do not run this. It only shows the pattern.

bash
echo '<long base64 blob>' | base64 -d | bash

Everything before the last pipe only converts text. The final bash executes whatever came out, so you learn what it did only after it ran. The same applies to sh, zsh and eval "$(...)".

Decode it without executing

  1. Select only the blob: the long string between the quotes. Leave out | base64 -d | bash.
  2. Copy it (⌘C).
  3. In Terminal, run:
bash
pbpaste | base64 -d

This reads the clipboard, decodes it and prints the result. Nothing is executed and nothing is changed.

  1. Read the output from top to bottom.

If the output is garbled or your terminal acts oddly, the decoded data may contain control characters. Make them visible:

bash
pbpaste | base64 -d | cat -v

To read it in a text editor instead:

bash
pbpaste | base64 -d > ~/Desktop/decoded.txt

This overwrites any existing decoded.txt on your Desktop. The file is not executable, so it can't run by accident. Delete it when you're done.

If your Mac's base64 rejects -d, try -D or --decode; the option names differ between macOS versions.

The pbpaste | base64 -d | pbcopy one-liner

bash
pbpaste | base64 -d | pbcopy

This replaces the clipboard with the decoded text. It is useful for tokens and config values, because the data never goes to a web decoder. For a blob an AI gave you there is one trap: don't paste the result into Terminal. Paste it into a text editor first. To undo, copy the original blob again from the chat.

What to look for in the decoded text

Treat it as a script from a stranger.

You seeWhy it matters
curl or wget fetching from an unfamiliar domainThe real payload is downloaded later and can't be read here
Anything piped into sh, bash, zsh or evalRuns code nobody has read
sudo, rm -rf, chmod 777 or chmod +x on things you didn't ask aboutElevated or destructive changes beyond your request
Edits to crontab, launch agents, ~/.ssh/authorized_keys or shell profilesPersistence or new ways to log in
Another base64 string, or base64 -d againAnother layer hiding the real content
Passwords, tokens or hostnames you never suppliedSomething is sent or stored that you didn't intend
Nothing related to what you asked forThe command doesn't do what you wanted

If the decoded text is a few readable lines that match your request, such as restarting a service or editing a config you named, run those lines yourself as plain commands. Don't run the blob.

Checklist before you run anything

  • You copied only the blob, not the surrounding command.
  • You decoded to the screen or an editor, not into a shell.
  • Every line is something you understand and asked for.
  • No unknown domains, no nested base64, no changes to logins or scheduled jobs.
  • You are running the plain decoded lines, not the original one-liner.

If the output is gibberish

  • It's compressed. Many blobs are gzip data encoded as base64. Decode and decompress in one step: pbpaste | base64 -d | gzip -dc
  • It's another layer. If the output is another base64 string, decode again.
  • It uses the URL-safe alphabet (- and _ instead of + and /) or has no = padding. The built-in command may reject it.
  • It's binary, not text. Scripts are normally text. A binary blob you didn't ask for is a reason to stop.
  • You copied too much. Copying the whole command line gives garbage or an error. Copy only the blob.

Decode it in Bytepliers (offline, no shell involved)

Terminal is enough for this job. Bytepliers helps if you would rather read the result in a text pane than a shell, or if the blob is URL-safe, unpadded or compressed. Decoding happens on your Mac and the tools make no network calls. Bytepliers is part of MacSuite, with a 7-day free trial (as of November 2026).

MethodBest whenWrites to your clipboard?
Base64 tool (⌘2)You want to read the result in a windowOnly if you copy
Quick Panel (⌥⌘B)You want a quick look from any appOnly if you press ⏎
Detect & Replace (⌥⇧⌘B)You want the one-liner without TerminalYes, replaces it
bytepliers commandYou live in TerminalNo

Base64 tool

  1. Open Bytepliers and press ⌘2 to open Base64.
  2. Paste the blob into the input pane (Paste from Clipboard or ⌘V).
  3. Choose Decode.
  4. Read the output pane.

Decode accepts both Base64 alphabets, whitespace and missing padding. For compressed data, open GZIP, choose Decompress and paste the Base64 there.

Bytepliers keeps recent inputs per tool in a local history. If you'd rather not keep a suspicious blob, open the tool's History button and choose Clear.

Quick Panel

  1. Copy the blob.
  2. Press ⌥⌘B in any app (the default shortcut).
  3. With Auto-detect, a Base64 blob is shown decoded. If it picks something else, type b64d to choose Base64 Decode.
  4. Press ⎋ to close without copying, or ⏎ to copy the result.

Long results are cut on screen at 20 KB or 400 lines; ⏎ still copies everything.

Detect & Replace Clipboard

Press ⌥⇧⌘B. For a Base64 blob, the clipboard is replaced with the decoded text and a HUD confirms it. Check that the HUD names Base64, since the transform depends on what was detected. Undo with Tools ▸ Restore Previous Clipboard. With no confident match, it beeps and leaves the clipboard alone. Results derived from secrets are written as concealed, so clipboard managers that honor that convention skip them. The same rule as pbcopy applies: read the result in an editor, not in a shell.

Command line

Install the command from Settings ▸ Integrations ▸ Command-Line Tool ▸ Install…, then run:

bash
pbpaste | bytepliers base64-decode

For a compressed blob, pbpaste | bytepliers gunzip runs the Base64 → Gunzip transform. The command needs a license or an active trial. Setup is in the command-line docs.

Why not an online decoder

A web decoder is fine for harmless text. But a blob from a server task can contain hostnames, tokens or paths, and you would be pasting them into a site you don't control. Decoding locally keeps them on your Mac. For more on the Terminal side, see how to encode and decode Base64 on Mac.

If you already ran it

Decode the blob now and read what it did. If it downloaded something, changed logins or scheduled jobs, or touched credentials, treat the machine as affected. On a server, that means restoring from a known-good state and rotating any passwords or keys the script could see.

If nothing works

If the blob won't decode, or the decoded text looks malicious, stop and ask a person. Contact your hosting provider's support or your security team, and include the original blob, the exact command the assistant gave, the time you ran it (if you did), and the decoded output. For Bytepliers problems, use MacSuite support.

text
An AI assistant gave me this command for my server. I have not run it / I ran it at [time].
The command contains a base64 blob. I decoded it and the output is below.
Please tell me whether it is safe and, if I ran it, what to check.

Command: [paste the full command]
Decoded output: [paste the output]

Common questions

Is base64 itself dangerous?

No. It is only an encoding. The danger is what the decoded text does when something executes it.

Why would an AI use base64 at all?

It lets a multi-line script or config travel as one line, avoiding quoting problems. That is convenient, but it also makes the command unreadable, so decode before you run.

Can I ask the assistant for a plain version?

Yes. Ask for the same fix as plain commands without base64. If you paste decoded text back to ask what it does, remove tokens and passwords first. An assistant can be wrong about what a command does, so the check stays with you: decode, read, then run.

Every app.
One purchase.