Web tool for fast base64 encoding decoding
- 4 minutes read - 802 wordsThere is a new pair of online base64 encoding-decoding tools in this world. They load pretty much as fast as it gets, there are no ads, data never leaves your browser and there is no cookie policy, because there are no cookies! Go try these!
Base64 world
On the web we live a lot in the base64-encoded world. It is one of standard ways to encode data without worrying whether it can break things if one day is passed via GET parameter or by accident included into the web page. If you run your web services on Kubernetes whenever you play with its secrets, you need to encode-decode the values of these secrets.
{
"kind": "Secret",
"apiVersion": "v1",
"metadata": {
"name": "typicalkubernetesscecret",
"namespace": "default",
"selfLink": "/api/v1/namespaces/default/secrets/databasesecret",
"uid": "ea295912-a022-11e9-adf2-8e8c302e0953",
"resourceVersion": "13978905",
"creationTimestamp": "2019-07-06T19:19:02Z"
},
"data": {
"password": "SGVsbG8gYmFzZTY0IQ=="
},
"type": "Opaque"
}
Command line utilities
On Mac and Linux (and on Windows as well?) there are useful utilities to help you with base64 encoding-decoding, for getting input from the clipboard and for putting the results back there
$ echo Hello base64! | base64
SGVsbG8gYmFzZTY0IQo=
$ echo SGVsbG8gYmFzZTY0IQo= | base64 -D
Hello base64!
# Now let's put string to the clipboad.
# Then let base64 decode it from clipboard and put the results back
$ echo Hello base64! | pbcopy
$ pbpaste | base64 | pbcopy
$ pbpaste
SGVsbG8gYmFzZTY0IQo=
Web tools
Command line is cool, but somehow that still feels like a bit too many clicks and I spend good share of the workday in the browser, so most of the time I am actually using online encoders for base64. There are quite many of these, I personally was finding www.base64decode.org most convenient.
Unfortunately most of these tools share several issues:
- They are bloated. There’s a lot of data to fetch. That base64decode.org at the moment of writing this post was taking 5.2MB to load. Not a big deal for an office network, but still a bit of a delay, even more so when working remotely. For some reason it also freezes Chrome’s inspector if I open it on that page. Possibly it is a result of a code analysis protection, but I often brwose web with the inspector open and sudden freezes are not nice.
- Ads. I don’t mind some, but many tools have these too much
- Most of online tools perform encode-decode on the backend. It causes a bit of a delay, but the biggest issue is that your dear data is being transfered to someone else’s computer, so you better not use such services for the database passwords and such.
- Tracking cookies. There’s little way to avoid tracking on the web nowadays, but it would be nice to use tools that don’t do it or do it in some minimal manner.
A new tool to the resque
So meet www.base64decode.xyz and www.base64encode.xyz. These are just one old good static HTML page with all the CSS and JavaScript in one file - takes just one request of 8.35KB (4KB gzipped) to load! Data never leaves the browser, there are no ads and no cookie policy, because, there are no cookies.
You can see the source code on GitHub from where the site is autopublished to Netlify. Feel free to examine, clone and/or submit pull requests.
Stats
Whenever you release a personal project to the web, one thing that is always interesting is stats, even if only a couple of people a month visit the site. I am interested in knowing how many people actually find the tool useful, but how to find it out without analytics services that track your visitors and put cookies.
Nowadays there are several paid analytics services that just count number of pageviews for you and possibly even Google Analytics can be told not to use cookies (you can provide your own fingerprinting to get rough number of unique users without tracking them precisely). I might give this option a try one day to figure how many people press this or that button, how often people switch between encoding-decoding, etc.
The simplest way just to count the page views, however, is to use server side stats. Unfortunately Netlify doesn’t provide these, but if you proxy the site through Cloudflare you can see how many requests Clouflare serves for you on that or another week and this particular bit of stats is free. I will probably cover this GitHub -> Netlify -> Cloudflare setup in one of the coming posts, so stay tuned if interested.
What do you, guys, think? Would you use such a base64 decoding-encoding tool online?
Update: I used https://www.base64encode.tk and https://www.base64decode.tk originally, but free domains and Freenom don’t get along so much that I don’t have access to these domains anymore, so relaunched on cool https://www.base64encode.xyz and https://www.base64decode.xyz