-
- EXPLORE
-
-
-
-
-
-
-
-
Base64 Decode and Encode online
Base64 is a widely used binary-to-text encoding scheme that transforms binary data into an equivalent ASCII character set by translating it into a radix-64 representation. It is commonly used for encoding and transporting data over media that are incompatible to transfer binary data. Base64 makes sure that the binary data doesn't change during transportation.
It is important to remember that Base64 is not an encryption or compression scheme. It only transforms the binary data into an ASCII character set that is extremely useful for transferring obfuscated strings over the network. For instance, a common example is sending an image or any other binary file to an email server that typically expects textual data. You have to first encode the binary file into a textual format, preferably ASCII.
In this article, you'll learn how to encode and decode Base64 strings in JavaScript. There are two built-in functions in JavaScript for encoding and decoding raw binary data into Base64 strings.
btoa()
— Base64 Encoding
The btoa()
function (stands for binary-to-ASCII) is used to create a Base64 encoded ASCII string from the binary data. It accepts the binary string as an argument and returns a Base64 encoded ASCII string.
The following example shows how you can use base64 decode online
btoa()
to Base64 encode a string in JavaScript:
atob()
— Base64 Decoding
The atob()
function (stands for ASCII-to-binary) decodes a string of data that was encoded using Base64 encoding back to normal text in JavaScript. Here is an example that shows how you can use atob()
to decode a Base64 encoding string:
Conclusion
That's all folks for Base64 encoding and decoding in JavaScript. Base64 is a widely used encoding scheme for securely transmitting binary data as a stream of ASCII characters over the network.
Of course, you can still choose to send binary data over the network. But it can be risky sometimes as not all applications and network communication devices can handle raw binary data. On the other hand, the ASCII character set is quite simple to handle for most applications.
- Art
- Causes
- Crafts
- Dance
- Drinks
- Film
- Fitness
- Food
- Games
- Gardening
- Health
- Home
- Literature
- Music
- Networking
- Other
- Party
- Religion
- Shopping
- Sports
- Theater
- Wellness