Decoding

How to decode Base64 inside a Markdown file on a Mac

You can do this with B64 by pasting the whole reference. Here is how, and what to do with a document full of them.

A Markdown document with embedded screenshots is self-contained, which is why they are embedded in the first place. It also means the pictures are not files, and sooner or later somebody wants one as a file — to attach it, to crop it, or to reuse it.

This guide covers getting one back out in B64.

Decoding is free

There is no purchase and no account for any of this, and no time limit on it. Encoding and Batch are the paid features; turning Base64 back into a picture is not.

Get the picture out

  1. Copy the whole image reference

    From the ! to the closing parenthesis. Alt text included — it does not get in the way.

  2. Open Decode and paste

    Press ⌘2 and paste. The payload between the parentheses is found and decoded.

  3. Save or copy it

    Save… writes it to disk; Copy Image puts it on the clipboard; Quick Look shows it full size first.

Paste all of this
![The failing dialog](data:image/png;base64,iVBORw0KGgoAAAANSUhEUg…)

Reference-style images work too

Markdown lets the payload live at the bottom of the document, referenced by a label from the body. In that case copy the definition line rather than the reference in the prose — the definition is where the data URI actually is.

Copy the definition, not the reference
In the body:    ![The failing dialog][shot1]

At the bottom:  [shot1]: data:image/png;base64,iVBORw0KGgoAAAANSUhEUg…
                └─ copy this line

A document full of images

Decode works on one payload at a time. For a document with a dozen screenshots in it, go one at a time — or, if you have already split them into separate text files, decode the folder in Batch in one pass.

Name them as you save

The alt text usually says what the picture is. Use it for the filename while it is in front of you — the Save panel is the last moment that context is free.

Troubleshooting

Nothing decoded

Check the copy reached the closing parenthesis. A soft-wrapped editor makes a very long line easy to cut short.

The reference points at a file path

Then there is no Base64 in it — the picture is a file at that path.

The image never rendered in my Markdown viewer in the first place

Many renderers strip data URIs for security reasons. The payload is still perfectly good; decode it here to see what it is. See embedding an image in Markdown for which situations this approach suits.

Going the other way

To put a picture into a document rather than take one out, see how to embed an image in Markdown.

Frequently asked questions

Do I need to remove the alt text and brackets?

No. Paste the whole reference; the payload between the parentheses is found for you.

What about reference-style images?

Copy the definition line at the bottom of the document, which is where the data URI actually lives, rather than the reference in the prose.

Can I extract every image in a document at once?

Decode handles one at a time. Split them into separate text files first if you want to run them through Batch in a single pass.

The image never displayed in my Markdown viewer — is the payload broken?

Not necessarily. Many renderers strip data URIs on purpose. Decode it here to see whether the payload itself is fine.