MIME file type identifier

Determine file MIME type or extension based on its signature or magic bytes.

MIME File Type Idenfitier

MIME is media type often abbreviated from Multipurpose Internet Mail Extensions.

How we detect MIME Type from a file? Well, we read the file signatures, also known as 'magic bytes'.

More advance explanation

So, we can ready the file signatures, mostly from the header / first few bytes of file. Then, we can match the bytes to coresponding unique magic bytes

Example

For example, we have a file with following bytes (we cut few bytes for the sake of simplicity)

89 50 4E 47 0D 0A 1A 0A 
BA BE FA CE AA BB CC DD
CA FE D0 D0 BE EE EE EF

These signatures 89 50 4E 47 0D 0A 1A 0A match PNG signature, hence it will be treated as PNG file (this condition true on most linux systems)

Cool facts:

  • if you use linux systems you will notice that the linux will treat the file based on the file signatures, not extension
Category
utility
Tags
About
Toolkit Bay or TKB is an online tools website providing free and easy to use tools to increase productivy.
If you have any inquiries or suggestions, you can contact us on: contact@toolkitbay.com (we can read the incoming emails, but most probably we won't answer since we haven't setup the mail server yet. Feel free to reach/DM us at https://www.facebook.com/toolkitbay)
Data & Privacy
We respect your data. Uploaded file/data/input will be automatically deleted. And the processed data will be deleted less than a day.
More detail on privacy here
Copyright © 2021 Toolkit Bay. All Rights Reserved