How To Decode Base64 In Most Popular Programming Languages

Base64 is a group of similar binary-to-text encoding schemes that represents binary data in an ASCII string format by translating it into radix-64 representation.

All examples below uses base64 decoded text (eWVhaGh1Yg==) for simplicity, but this is not a typical use case, as it can already be safely transferred across all systems that can handle Base64.

Suggested Read: How To Encode Base64 In Most Popular Programming Languages

Encoded Format

eWVhaGh1Yg==

The result of above decoded string is “yeahhub“.

Using the below base64 examples which actually turns your encoded data into binary data.

In Python Language – 

import base64
print base64.b64decode(“eWVhaGh1Yg==”)

In Windows PowerShell – 

PS > [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String(“eWVhaGh1Yg==”))

In Perl Language – 

use MIME::Base64;
print decode_base64(“eWVhaGh1Yg==”);
print “\n”;

In Bash Language – 

echo `echo eWVhaGh1Yg== | base64 –decode`

In PHP Language – 

<?php
echo base64_decode(“eWVhaGh1Yg==”);
?>

In Javascript Language – 

<p id=”result”></p>
<script>
document.getElementById(“result”).innerHTML = atob(“eWVhaGh1Yg==”);
</script>

In MySQL Language – 

use mysql;
SELECT FROM_BASE64(‘eWVhaGh1Yg==’);

In Ruby Language – 

require “base64”
decoded_string = Base64.decode64(‘eWVhaGh1Yg==’)
puts decoded

You may also like:

Sarcastic Writer

Step by step hacking tutorials about wireless cracking, kali linux, metasploit, ethical hacking, seo tips and tricks, malware analysis and scanning.

Related Posts