Skip to content

Instantly share code, notes, and snippets.

@while0pass
Created November 3, 2010 13:29
Show Gist options
  • Save while0pass/661069 to your computer and use it in GitHub Desktop.
Save while0pass/661069 to your computer and use it in GitHub Desktop.
1px transparent gif image base64 encoded within data scheme url
data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
<img width="1" height="1" title="" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" />
@while0pass
Copy link
Author

If this short base64 representation for 1px transparent gif is valid, it is far more better. bjrke, if it is really valid, could you explain why or give some reference to read. thank you in advance

@bjrke
Copy link

bjrke commented Aug 11, 2011

try it, it is a 1px x 1px gif with a 1bit palette, created with gimp and encoded with base64 tool in linux.

@while0pass
Copy link
Author

That's great. Thank you. It seems there was lot of unnecessary metadata in the image, because new base64 is a discontinuous substring of the previous one. Thank you once again.

@HazemNoor
Copy link

This is smaller

data:image/gif;base64,R0lGODlhAQABAAAAACw=

@mansilladev
Copy link

@HazemNoor - that shorter one seems to leave a placeholder border on some browsers and mobile devices. (even with all border CSS attributes set to none)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment