In PowerShell, decode Base64 with [System.Convert]::FromBase64String(), then turn the returned bytes into UTF-8 text.
In a standard PowerShell installation, there is no ConvertFrom-Base64 cmdlet; the .NET Convert class supplies the operation. The important distinction is that Base64 decoding produces bytes, not automatically a readable string. If those bytes represent text, choose the correct character encoding next. If they represent a PDF, image, archive, or other binary object, keep them as bytes and write them directly to a file.

Decode a Base64 string in PowerShell
Use the following sequence when the Base64 value should become text:
-
Open PowerShell and assign the encoded value to a variable. Quoting keeps the payload together as one string.
$base64 = 'SGVsbG8='
-
Call FromBase64String() and keep its result as a byte array. This method returns bytes; it does not select UTF-8 or another text encoding for you.
[byte[]]$bytes = [System.Convert]::FromBase64String($base64)
-
Create a strict UTF-8 decoder and pass it the bytes. The first constructor argument suppresses a UTF-8 byte-order mark when encoding text for output, while the second makes invalid UTF-8 sequences throw an error.
$decoder = [System.Text.UTF8Encoding]::new($false, $true)
$text = $decoder.GetString($bytes)
-
Print the decoded string. For the sample value above, the output is Hello.
$text
For a short value, the convenience form is:
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('SGVsbG8='))
This one-line version uses .NET’s default replacement behavior for malformed UTF-8. Use the strict decoder when a script should reject invalid byte sequences rather than silently replace them.
Use strict UTF-8 for Unicode text
Base64 describes bytes, not the meaning or encoding of those bytes. Text containing accents, Chinese characters, or emoji must be converted to UTF-8 before it is Base64-encoded, and decoding must apply UTF-8 again. A strict decoder prevents damaged bytes from appearing as plausible but incorrect characters.
Base64 padding follows a fixed rule because three input bytes are represented by four Base64 characters:
| Input byte count modulo 3 | Required padding |
|---|---|
| 0 | None |
| 1 | Two equals signs: == |
| 2 | One equals sign: = |
The RFC 4648 Base64 specification defines this grouping and padding behavior. The padding keeps the encoded length a multiple of four, as compliant decoders expect. Keep the equals signs when moving a value between systems; removing them can make an otherwise valid payload fail in a decoder that expects standard padding.
PowerShell’s FromBase64String() reports malformed Base64 with a FormatException. If text decodes but looks incorrect, the encoded bytes may use a character set other than UTF-8. Select the matching .NET encoding for that legacy payload; the UTF-8-focused browser workflow described below is appropriate for UTF-8 text.
Decode a Base64 file in PowerShell
A file containing Base64 may hold a raw payload or include a wrapper. Remove items such as a data: URI prefix or PEM header and footer before conversion because those markers are not part of the Base64 data.
-
Confirm that the file contains only the Base64 payload.
-
Read the file as one string. The .NET decoder ignores whitespace characters, so ordinary line wrapping and spaces in a raw Base64 file are tolerated.
$encoded = Get-Content -Raw -LiteralPath '.\payload.b64'
-
Convert the text to bytes.
[byte[]]$bytes = [System.Convert]::FromBase64String($encoded)
-
For a binary result, write the bytes directly to the destination file.
[System.IO.File]::WriteAllBytes((Join-Path (Get-Location) 'decoded.bin'), $bytes)
-
For a UTF-8 text result, decode strictly and write the resulting string.
$decoder = [System.Text.UTF8Encoding]::new($false, $true)
$text = $decoder.GetString($bytes)
[System.IO.File]::WriteAllText((Join-Path (Get-Location) 'decoded.txt'), $text, $decoder)
For images, PDFs, archives, and other binary data, WriteAllBytes() is the correct operation because it preserves the decoded bytes exactly. Passing those bytes through GetString() interprets them as text and can fail or alter the result.
Decode UTF-8 text in the browser
For UTF-8 text, the browser-based Base64 Encode / Decode provides a script-free workflow:
-
Open the tool and choose Decode (Base64 → text).
-
Paste the Base64 value into the input box.
-
Read the decoded text in the output box, which updates instantly as the input changes.
-
Select Copy to transfer the result.
The tool converts text to UTF-8 bytes before encoding and reverses that process when decoding, so accents, Chinese characters, and emoji are handled correctly. Its strict UTF-8 validation catches malformed input instead of producing silent garbage, and its RFC 4648 implementation retains the required padding rules. Every conversion happens locally in the browser, and nothing is sent to a server.
One limitation matters: this tool produces decoded text, not an arbitrary binary-file download. Use the PowerShell byte-writing workflow for PDFs, images, archives, or other non-text payloads. For a broader comparison of command-line and browser decoding, the practical differences center on output type, Unicode handling, and file support.
Match the decoder to the payload
The right workflow depends on what the encoded bytes represent and whether the final result must be a string or a file.
| Payload or format | PowerShell workflow | Browser workflow or limitation |
|---|---|---|
| UTF-8 text | Decode bytes with a strict UTF-8 decoder | Use Decode mode and copy the text result |
| Binary file | Decode bytes and use WriteAllBytes() | The browser tool validates UTF-8 text rather than exporting arbitrary binary |
| Base64 text file | Read it with Get-Content -Raw, then decode | Copy the raw payload into the input box |
| Data URI | Remove the data-type and base64 prefix first | Paste only the encoded payload |
| PEM content | Remove the BEGIN and END lines first | Paste only the Base64 body |
| JWT or Base64url | Decode one segment after converting its URL-safe characters | Convert - and _ before using the standard alphabet |
A JSON Web Token is not one Base64 value: it has three dot-separated segments, and its segments use the URL-safe Base64 alphabet. Do not paste the complete token into a standard Base64 decoder. Decode one segment at a time, translate - to + and _ to /, and apply the padding required by RFC 4648.
Fix the usual Base64 decoding errors
- FormatException or malformed input: Check for wrappers, copied punctuation, broken character groups, or missing standard padding. The decoder expects only the Base64 payload, not a data URI or PEM labels.
- Text appears garbled: The source bytes may use a non-UTF-8 encoding. In PowerShell, choose the corresponding .NET character encoding; the browser tool’s text workflow is specifically UTF-8 based.
- The decoded file will not open: You may have treated binary bytes as text. Decode to a byte array and use WriteAllBytes() instead of writing a string.
- A copied value contains unusual spaces or quotation marks: Standard Base64 uses only the characters A–Z, a–z, 0–9, +, /, and padding. Smart quotes and full-width spaces are not part of the format.
- You need confidentiality: Local processing prevents an upload, but Base64 itself is not encryption. Anyone with the encoded value can reverse it, so it must not be used to protect passwords or secrets.
For a deeper look, see Base64 to Hex in Python: Strict, Byte-Exact Results.