Advantages and disadvantages of Base64

Time:2021-9-16

What is Base64

Base64 is one of the most common encoding methods for transmitting 8bit bytecode on the network. Base64 is a method to identify binary data based on 64 printable characters.
Base64 is a reversible encoding method, which uses 64 ASCII characters to represent arbitrary binary data.
It is mainly used to convert non printable characters into printable characters, or simply encode binary data into ASCII characters

Advantages and disadvantages of converting pictures to Base64 format

  • 1. Advantages
(1) Base64 images are text format, which takes up less memory. After conversion, the size ratio is about 1 / 3, which reduces the consumption of server resources.
(2) When Base64 format pictures are used in web pages, the server is no longer required to call picture resources, which reduces the number of server accesses.
(3) Base64 encoded string is more suitable for transmission on different platforms and languages.
(4) The algorithm is coding, not compression. After coding, only the number of bytes will be increased, but the algorithm is simple and will hardly affect the efficiency. The algorithm is reversible and easy to decode. There is no need to communicate with private information.
(5) It's easy to decode, but after all, it's encoded. The naked eye can't directly see the original content
  • 2. Shortcomings
(1) There are many text contents in Base64 format, which is stored in the database, increasing the pressure on the server
(2) Although the web page does not need to access the server when loading pictures, because there are too many contents in Base64 format, the speed of loading web pages will be greatly reduced, which may affect the user experience.
(3) Base64 cannot be cached. To cache, you can only cache files containing Base64, such as JS or CSS, which is much worse than directly caching pictures. Generally, HTML changes are frequent, so it is equivalent to no caching benefit.

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Recommended Today

Detailed steps for installing Perl and Komodo IDE for windows

Perl official website: https://www.perl.org/Perl document: https://perldoc.perl.org/Download address: https://www.perl.org/get.html The installation package of Perl Windows version is divided into activestate Perl and strawberry Perl. For the difference between the two, see: http://www.zzvips.com/article/202134.htm Note: the download speed of activestate Perl is slow. You may need KX to surf the Internet I have uploaded all the versions of […]