Please enable JavaScript to view the comments powered by Disqus.File Magic Number
Search
♦️

File Magic Number

File Magic Numbers
Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.
For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.
This gives an ongoing list of file-type magic numbers.
Search
Image File Magic Number
File type
Typicalextension
Hex digitsxx = variable
Ascii digits. = not an ascii char
.fits
53 49 4d 50 4c 45
SIMPLE
.gif
47 49 46 38
GIF8
.gks
47 4b 53 4d
GKSM
.itc
f1 00 40 bb
....
.nif
49 49 4e 31
IIN1
.pm
56 49 45 57
VIEW
.png
89 50 4e 47
.PNG
.ras
59 a6 6a 95
Y.j.
.tga
xx xx xx
...
.xcf
67 69 6d 70 20 78 63 66 20 76
gimp xcf
.fig
23 46 49 47
#FIG
.xpm
2f 2a 20 58 50 4d 20 2a 2f
/* XPM */
Search
File type
Typicalextension
Hex digitsxx = variable
Ascii digits. = not an ascii char
.bz
42 5a
BZ
.Z
1f 9d
..
.gz
1f 8b
..
.zip
50 4b 03 04
PK..
Search
File type
Typicalextension
Hex digitsxx = variable
Ascii digits. = not an ascii char
.tar
xx xx
(a filename)
.tar
75 73 74 61 72
ustar (offset by 257 bytes)
Search
File type
Hex digitsxx = variable
Ascii digits. = not an ascii char
Search
File type
Hex digitsxx = variable
Ascii digits. = not an ascii char