News for hackers. Stuff that matters.

Why do websites use src=data:image/png;base64

Many websites use src=data:image/png;base64 for images. It results a huge string of gibberish that renders a small image. What advantage does this have over just uploading the image and linking to it? Wouldn't the huge string of gibberish slow the site down by increasing the memory size of the page?
( 2 comments | 3 points | on HN )
Re:Why do websites use src=data:image/png;base64 by yrezgui on Tuesday February 20, 2018 @12:31PM (#16422099)
For some websites, the cost of making a new HTTP request to get the image is higher than inlining it in the page in terms of performance
Re:Why do websites use src=data:image/png;base64 by schoen on Tuesday February 20, 2018 @06:48PM (#16425452)
For example, in terms of latency because of the network round-trips to establish the connection (or even just to send an additional HTTP request inside the existing session and wait for a reply!).