I have a file that's .gif extension but I suspect that it's a lie and it's actually a webp. What's the best way to know what format the file is?
By looking into file content and checking its magic number. For webp it's WEBP
and for GIF file it is GIF87a/GIF89a
.
Here you have list of all magic numbers and where it is located in file: https://en.wikipedia.org/wiki/List_of_file_signatures