![](/filedb/4/1/53814.png)
How to Recover Data From Chrome's Cache
Have you ever needed to pull an old web page out of the Chrome cache, and wondered how to do it? I had to do this recently myself.
I was editing a comment on reddit, and for some reason it wasn't taking. After hitting reload I discovered to my horror that instead of editing the comment, reddit had replaced the entire text of my post with my edited comment! This was terrible because the post was very long and had been edited a few times. Trying to recreate it from memory would be impossible.
I quickly grabbed my laptop hoping that the post would still be up on the browser from earlier, but it wasn't. In order to prevent Chrome from downloading a fresh copy, I disabled the wifi on the laptop and loaded chrome://cache where I found my post's URL there. When I pulled it up I got a hex dump of the content that had been received from the server. Since it was what had been received from the server, the content was compressed with gzip, so there wasn't even any plain text to skim through.
How to get back the plain text? Was I going to have to hack together a program to convert the hex dump back to binary so I could decompress it? Turns out it was much simpler than that.
To get the cache converted back into the HTML you need to copy the buffer from the second block of hex data. Paste that into a file, then simply use xxd to convert the hexdump back into binary. From there you can run it through gunzip and presto!
xxd -r < cached-hex.txt | gunzip > cached.html