TL;DR
This guide shows you how to decode a string encoded in Base64 and check if the decoded result looks like useful data (e.g., text, JSON, or a common file format). We’ll cover online tools and command-line methods.
Steps
- Understand Base64
- Online Decoder
Base64 is a way to represent binary data as ASCII characters. It’s often used when you need to send files or other non-text data through systems that only handle text. Decoding turns the Base64 string back into its original form.
The easiest way is using an online decoder:
- Go to a website like Base64 Decode or similar.
- Paste your Base64 string into the input box.
- Click “Decode”.
- Examine the output. Does it look like readable text, JSON data, or something else meaningful?
If you’re comfortable with the command line, use this:
base64 -d <your_base64_string>
For example:
echo "SGVsbG8gd29ybGQh" | base64 -d
This will output: Hello world!
PowerShell can decode Base64:
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String(""))
For example:
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("SGVsbG8gd29ybGQh"))
This will output: Hello world!
- Text: If it’s readable English (or another language), you’ve likely decoded something useful.
- JSON: Look for curly braces
{...}and square brackets[...]. You can use a JSON validator to check if the output is valid JSON. Many online validators are available, such as JSONLint. - File Header: If it starts with recognisable file headers (e.g.,
PKfor ZIP files,GIF89afor GIFs), you’ve likely decoded a binary file. You can try saving the output to a file and opening it with the appropriate application. - Garbage: If it’s just random characters, the Base64 string might be invalid or not what you expect. It could also be encrypted data requiring further steps.
Sometimes a string is encoded multiple times. Try decoding it several times in a row. This is uncommon, but worth trying if the first decode doesn’t produce anything meaningful.