What is Base64?
4 November 2022 (Updated 7 November 2022)
In a nutshell
Base64 is a group of binary-to-text encoding schemes that lets you represent binary data in an ASCII string format by translating the binary into a radix-64 representation.
Because base64 encoding uses only ASCII characters, binary data can be base64 encoded and then used in a data:
URL
Encode binary string into base64 using btoa()
btoa('Hello world')
// 'SGVsbG8gd29ybGQ='
Decode base64 into string using atob()
atob('SGVsbG8gd29ybGQ=')
// 'Hello world'
Other notes
- Because of how Base64 encoding works, a base64 encoded version will be at least ~33% larger than its source.
Sources
Tagged:
HTTP
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment