FAT12, FAT16 and FAT32 (with VFAT long names) are the simplest and most widely supported file systems: floppy disks, SD cards up to 32 GB, USB sticks, camera media and the UEFI system partition. Dating from 1977-1996, they remain ubiquitous for removable media, with FAT32 limited to 4 GiB files and replaced by exFAT on larger flash cards.
Overview
FAT divides the volume into clusters and tracks each cluster’s successor in a File Allocation Table, kept in two copies. A file is a chain of clusters starting from a number stored in a 32-byte directory entry. The three variants differ in table entry width (12, 16 or 28 usable bits of 32). FAT12 and FAT16 have a fixed root directory; FAT32 keeps the root in the data area and adds an FSInfo sector. Long file names are stored as extra UTF-16 directory entries (VFAT) alongside an 8.3 short name.
History
Created in 1977 by Bill Gates and Marc McDonald for Microsoft Standalone Disk BASIC; FAT12 shipped with MS-DOS and 86-DOS in 1980-81.
FAT16 arrived with MS-DOS 3.x/4.0 and larger disks; FAT32 was introduced with Windows 95 OSR2 in 1996.
VFAT long file names were added in Windows 95.
Structures
Offsets are in bytes from the start of the structure named in each heading. Field names are descriptive and are not an official specification. Fixed-width integers are shown as u/i (unsigned/signed) followed by bit width and byte order.
Read Fs Info Free Count
Offset
Size
Type
Field
Notes
0x0
4
u32 LE
–
0x1E4
4
u32 LE
–
0x1E8
4
u32 LE
Free
Build Entry
Offset
Size
Type
Field
Notes
0xB
1
u8
Attributes
0xD
1
u8
Created
0xE
2
u16 LE
Created
0x10
2
u16 LE
Created
0x12
2
u16 LE
Accessed
0x14
2
u16 LE
–
0x16
2
u16 LE
Modified
0x18
2
u16 LE
Modified
0x1A
2
u16 LE
Cluster
0x1C
4
u32 LE
Size
Entry Cluster
Offset
Size
Type
Field
Notes
position + 20
2
u16 LE
–
position + 26
2
u16 LE
Cluster
Enumerate Lost Entries
Offset
Size
Type
Field
Notes
0xD
1
u8
Created
0xE
2
u16 LE
Created
0x10
2
u16 LE
Created
0x16
2
u16 LE
Modified
0x18
2
u16 LE
Modified
Parse Entries
Offset
Size
Type
Field
Notes
position + 11
1
u8
Attributes
position + 12
1
u8
–
position + 26
2
u16 LE
–
Try Parse
Offset
Size
Type
Field
Notes
0x0
1
u8
–
0x3
8
bytes
Oem Name
0xB
2
u16 LE
Bytes Per Sector
0xD
1
u8
Sectors Per Cluster
0xE
2
u16 LE
Reserved
0x10
1
u8
Fats
0x11
2
u16 LE
Root Entries
0x13
2
u16 LE
Total
0x15
1
u8
Edia
0x16
2
u16 LE
Fat Size
0x20
4
u32 LE
Total
0x24
4
u32 LE
Fat Size
0x28
2
u16 LE
Extended Flags
0x2C
4
u32 LE
Root Cluster
0x30
2
u16 LE
Fs Info
0x32
2
u16 LE
Backup
0x1FE
1
u8
Has Boot Signature
0x1FF
1
u8
–
(extended + 3)
4
u32 LE
Serial
extended + 2
1
u8
–
extended + 7
11
bytes
Label
Get
Offset
Size
Type
Field
Notes
(int)position
2
u16 LE
Bad Cluster
position + 1
1
u8
Value
Other fields read
Read in
Offset
Size
Type
Field
Notes
Assemble Long Name
entry + offset + k * 2
2
u16 LE
Unit
Get
(int)(position % PageSize)
4
u32 LE
–
Constants
Fat File System
Name
Value
Type
Notes
EntrySize
32
int
FreeCountThreshold
4 * 1024 * 1024
uint
AttrReadOnly
0x01
byte
AttrHidden
0x02
byte
AttrSystem
0x04
byte
AttrVolumeLabel
0x08
byte
AttrDirectory
0x10
byte
AttrArchive
0x20
byte
AttrLongName
0x0F
byte
DeletedMarker
0xE5
byte
Fat Table
Name
Value
Type
Notes
PageSize
64 * 1024
int
Implementation limits
Class
Name
Value
Notes
Fat File System
MaxDirectoryBytes
4L * 1024 * 1024
Fat File System
MaxDeletedDirectoryBytes
2L * 1024 * 1024
Fat File System
MaxLostFolders
100_000
Fat File System
MaxLongNameEntries
20
Fat Table
MaxCachedPages
1024
Fat Type
Name
Value
Fat12
(next)
Fat16
(next)
Fat32
(next)
Signatures and magic strings referenced
Text
Where checked
.
Enumerate Lost Entries
..
Enumerate Lost Entries
Structures and constants were extracted from the implementation. Prose sections are a summary from public sources; verify details before relying on them.