Example 1 — Decode a Base64 String
Turn a base64 string back into the original text.
<?php
$encoded = "SGVsbG8gV29ybGQ=";
echo base64_decode($encoded), PHP_EOL; How It Works
- Start with base64 text. It was made with
base64_encode(). - Call base64_decode(). Each group of 4 characters becomes 3 bytes.
- Get the original data. Here it is the text
Hello World. - Print the result.
echoshows it with a new line.

