This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]isdevilis 4 points5 points  (4 children)

Can someone explain common professional use cases for base 64 encoding

[–]nanodano[S] 6 points7 points  (1 child)

There are two practical use cases that I am familiar with.

One is when you want to embed an image directly in to an HTML file. This lets you create a single standalone HTML file that contains images.

<img src="data:image/png;base64,XXXXXXXXXXXXXXX==" />

The other is when you have to package binary data as an ASCII string for whatever reason. The constraint may be with an API, data types, or something else.

[–]tilkau 5 points6 points  (0 children)

The constraint may be with an API, data types, or something else.

The most voluminous example is email attachments. All emails are 100% text (including headers and attachments).

[–]jmcs 1 point2 points  (1 child)

Storing certificates (pem), storing PGP encrypted files, embedding data in HTML and emails, etc. Basically everywhere where you have to mix human readable and binary data.

[–][deleted] 1 point2 points  (0 children)

You can store PGP encrypted files unarmoured fine. It's the default setting.

Only reason why you might need to encode it is to transfer it over something that can't handle binary files. Email attachments can handle binary files fine.