You can use direct access to this page from your browser address bar.
Type string that you need to encode/decode with algorithm according to next schema:
https://md5calc.com/base64/<TYPE:enc|dec>/<PHRASE>
For example to visit page that contains encoded "hello world" you can just visit url:
https://md5calc.com/base64/enc/hello+world
The another cool thing is that you can specify "json" or "plain" mode into URL and you
will get only encoded/decoded in response.
Schema of this future:
https://md5calc.com/base64/<TYPE:enc|dec>.<OUTPUT:plain|json>/<PHRASE>
Example:
https://md5calc.com/base64/enc.plain/hello+world
Will output:
aGVsbG8gd29ybGQ=
We have removed CORS restriction so you can use direct access to base64 encode/decode in your javascript applications via AJAX.
Example:
var toEncode = 'hello world';
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
console.log('Base64 of "'+toEncode+'" is "'+JSON.parse(xhr.response)+'"');
};
};
xhr.open('GET', 'https://md5calc.com/base64/enc.json/'+encodeURIComponent(toEncode), true);
xhr.send();
Will output:
Base64 of "hello world" is "aGVsbG8gd29ybGQ="
Keep in mind that this example no make sense because Javascript has builtin functions atob() and btoa() which do the same.
You can use direct access to this function in your applications.
PHP Example:
<?php
$str = 'hello world';
$url ='https://md5calc.com/base64/enc.plain/'.urlencode($str);
$base64 = file_get_contents($url);
echo 'Base64 of "'.$str.'" is "'.$base64.'"';
Will output:
Base64 of "hello world" is "aGVsbG8gd29ybGQ="
Keep in mind that this example no make sense because PHP has builtin functions base64_encode() and base64_decode() which do the same.
<?php
$str = '¡Hola!';
$base64EncodedStr = base64_encode($str);
$base64DecodedStr = base64_decode($base64EncodedStr);
echo '<pre>';
echo $str.PHP_EOL
.' → '.$base64EncodedStr.PHP_EOL
.' → '.$base64DecodedStr.PHP_EOL
;
echo '</pre>';
var str = 'https://localhost/?param1=¡Hola!¶m2=¡Hola!';
var base64EncodedStr = btoa(str);
var base64DecodedStr = atob(base64EncodedStr);
console.log(str);
console.log('-> ' + base64EncodedStr);
console.log('-> ' + base64DecodedStr);