A DAT file is a generic data file. The .dat extension does not belong to any single program, so no one app opens every DAT file. To open one, you first work out which program created it, then use that program or a tool that understands the real format inside.
Two shortcuts cover most cases. If the file is winmail.dat attached to an Outlook email, it is a TNEF container and needs a TNEF reader. If it is AVSEQ01.DAT from a Video CD, it is MPEG video and VLC will play it. For anything else, check where it came from and look at its first few bytes, its file signature, which nearly always gives the format away. And never run a DAT file you don't recognise.
Why DAT files are so confusing
DAT just means "data". Programs use the extension for whatever information they need to store: settings, saved games, caches, indexes, attachments or media. Because any developer can call a file something.dat, two DAT files can have nothing in common. One is plain text, another is a SQLite database, a third is MPEG video, and a fourth is a proprietary format that only one game understands.
That is why Windows often shows a DAT file with a blank icon and asks "How do you want to open this file?". It has no way of knowing what is inside from the extension alone. The kinds you are most likely to meet:
Kind of DAT file | Typical example | What opens it |
|---|
Plain text or CSV data | Exported settings, logs, data dumps | Notepad, Notepad++, VS Code, Excel |
Email attachment container | winmail.dat (TNEF) | A TNEF reader, or ask the sender to resend |
Video | AVSEQ01.DAT on a Video CD | VLC media player |
Game or app data | Save files, asset archives, caches | Only the original game or app |
System data | NTUSER.DAT (a Windows registry hive) | Windows itself. Do not edit or delete |
How to tell what created a DAT file
Work through these checks in order. Most files are identified by the first or the third.
Start with where it came from
The context usually tells you more than the file does. An email attachment called winmail.dat is an Outlook TNEF container. A file in an MPEGAV folder on a disc, or a copy of one, is Video CD video. Anything inside a game or program folder belongs to that game or program. NTUSER.DAT in the root of your user profile, or a DAT file in a system folder, belongs to Windows and should be left alone. And if someone sent you the file, the fastest answer is to ask them which program produced it.
Try a text editor
Right-click the file, choose Open with, and pick Notepad, or open it in VS Code. On a Mac, TextEdit does the same job. This is safe: a text editor only displays bytes, it never runs them.
If you see readable words, comma-separated values, XML or JSON, you are done. It is a text file. If you see a wall of strange symbols, it is binary. Close the editor without saving and move on to the signature.
Read the file signature
Most binary formats start with a fixed sequence of bytes called a file signature, magic number or magic bytes. A PNG always starts with 89 50 4E 47, a PDF with %PDF, and a ZIP with PK. The first 16 bytes usually reveal the real format, whatever the extension claims.
PowerShell has a hex viewer built in. Microsoft's own Format-Hex reference uses exactly this technique to identify a file with an odd extension as a PDF from its %PDF header.
# PowerShell 7 (Count was added in PowerShell 6.2)
Format-Hex -Path .\mystery.dat -Count 32
# Windows PowerShell 5.1 has no -Count, so keep the first two rows (32 bytes)
Format-Hex -Path .\mystery.dat | Select-Object -First 2
On macOS and Linux, the built-in file and xxd commands do the same job:
file mystery.dat
xxd mystery.dat | head -n 2
Any graphical hex editor works too. Compare what you see with these common signatures:
First bytes (hex) | As text | Real format |
|---|
89 50 4E 47 0D 0A 1A 0A | .PNG | PNG image |
FF D8 FF | ÿØÿ | JPEG image |
25 50 44 46 2D | %PDF- | PDF document |
50 4B 03 04 | PK | ZIP container (also DOCX, XLSX, JAR, APK) |
78 9F 3E 22 | x.>" | TNEF (winmail.dat) |
52 49 46 46 ... 43 44 58 41 | RIFF....CDXA | Video CD MPEG video (AVSEQ01.DAT) |
00 00 01 BA | (non-printable) | MPEG program stream video |
53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00 | SQLite format 3 | SQLite database |
D0 CF 11 E0 A1 B1 1A E1 | (non-printable) | OLE compound file (old .doc/.xls, Outlook .msg) |
1F 8B | (non-printable) | gzip archive |
4D 5A | MZ | Windows executable. Do not run it |
The TNEF value comes from Microsoft's MS-OXTNEF specification, which defines the stream signature as the little-endian value 0x223E9F78; on disk, that reads 78 9F 3E 22. For formats not listed here, Wikipedia's list of file signatures is the reference I would check next.
Let TrID guess
If the signature isn't in any table you know, try TrID by Marco Pontello. It compares a file against a database of more than 22,000 file type definitions and lists the most likely matches with a percentage. As of October 2026 it is free for personal and non-commercial use. Download it only from the author's site, mark0.net.
Text DAT files
A lot of DAT files are just text: exported lists, configuration files and logs. To open one without changing your file associations:
- Right-click the file and choose Open with → Choose another app.
- Pick Notepad, or click More apps to choose Notepad++ or VS Code.
- Leave Always use this app unticked, so you don't link every DAT file to a text editor.
If the first line looks like name,age,city, it is CSV data, and Excel can import it through Data → From Text/CSV, which lets you choose the delimiter and encoding. If every second character is a gap or a dot, the file is probably UTF-16 text; VS Code and Notepad++ can reopen it with a different encoding.
Don't save changes to a DAT file that belongs to a program unless you know the format. A single extra line break can stop the program from reading it.
winmail.dat instead of your attachment
If an email arrives with a winmail.dat attachment and the real attachment is missing, the sender's Outlook sent the message in Rich Text Format. Outlook and Exchange then wrap the formatting and attachments in Microsoft's Transport Neutral Encapsulation Format (TNEF). Outlook understands TNEF. Many other clients, including Thunderbird without an add-on and many mobile and webmail apps, show the whole package as a single winmail.dat.
Sender writes email in Outlook (Rich Text Format)
↓
Outlook/Exchange packs formatting + attachments into TNEF
↓
Recipient's non-Outlook client cannot read TNEF
↓
Everything shows up as one winmail.dat attachment
The real fix is on the sender's side, so the easiest route is to ask them to resend in HTML or plain text. For a single message, they open the Format Text tab in the Outlook message window and choose HTML instead of Rich Text. To change it for good in classic Outlook for Windows, they go to File → Options → Mail and set Compose messages in this format to HTML. Exchange and Microsoft 365 admins can stop TNEF going to external domains altogether through the remote domain settings:
# Exchange Online PowerShell: never send TNEF to external recipients
Set-RemoteDomain -Identity Default -TNEFEnabled $false
If the sender can't resend, extract the attachments yourself with a TNEF reader:
- In Thunderbird on any OS, the LookOut (fix version) add-on decodes TNEF attachments. Install it from the official Thunderbird add-ons site.
- On macOS, TNEF's Enough is a free app on the Mac App Store. Check its listed macOS compatibility first.
- On Linux, the
tnef command-line tool is in most distribution repositories. Run tnef winmail.dat to extract the files. - On Windows, several desktop TNEF viewers exist. Pick a well-known publisher and scan the download.
I would avoid online "winmail.dat viewer" websites for anything confidential. Uploading the attachment sends its contents to a third-party server.
Video CD DAT files
Video CDs were a popular format for movies and home video before DVDs. A VCD keeps its video in a folder named MPEGAV, as files called AVSEQ01.DAT, AVSEQ02.DAT and so on. These are MPEG-1 video wrapped in a RIFF container with the CDXA subtype, which is why they begin with RIFF and have CDXA at byte 8.
VLC media player plays them directly. Install it from the official site, videolan.org, choose Media → Open File, browse to the MPEGAV folder and select the .DAT file. If playback from an old disc stutters, copy the DAT file to your hard drive and play the copy, because scratched discs often read better in one straight copy than during playback.
FFmpeg can convert most VCD DAT files to MP4:
ffmpeg -i AVSEQ01.DAT -c:v libx264 -crf 20 -c:a aac -b:a 160k AVSEQ01.mp4
To keep the original quality without re-encoding, remux the MPEG stream into an .mpg file instead:
ffmpeg -i AVSEQ01.DAT -c copy AVSEQ01.mpg
Game, app and Windows DAT files
Games and desktop applications use DAT files for saves, settings, asset archives, level data and caches. These are usually proprietary, and some are compressed or encrypted, so the original program is the only thing that reads them reliably. Back the file up before you touch it, and don't rename it: the program looks for exact file names, and a renamed DAT file is a missing DAT file. Popular games often have community modding tools that understand their archives. Get those only from established modding sites or the project's official repository.
Windows deserves its own warning. NTUSER.DAT is your user registry hive, holding your personal Windows settings, and deleting or editing it can break your profile. Other DAT files under C:\Windows and C:\ProgramData usually belong to Windows or installed software. Leave them alone unless a vendor's support article tells you otherwise.
Converting a DAT file
There is no universal "DAT converter", because DAT is not one format. Converting a DAT file means converting whatever is inside it, so start from the signature:
If the signature shows | Do this |
|---|
PNG, JPEG, PDF, ZIP | Copy the file and rename the copy with the matching extension (.png, .jpg, .pdf, .zip), then open it normally |
Plain text or CSV | Rename a copy to .txt or .csv, or import it into Excel |
RIFF CDXA or MPEG stream | Convert with FFmpeg as shown above |
TNEF | Extract the attachments with a TNEF reader |
SQLite | Open a copy in DB Browser for SQLite or the sqlite3 command-line tool, then export to CSV |
Unknown binary | Use the original program's own Export or Save As feature |
Renaming changes the label, not the contents. It works when the contents are already in the target format and fails silently when they are not, so a file starting with %PDF will open as a PDF after renaming and nothing else will. Always rename a copy, never the original.
Be wary of sites offering a "free DAT file converter" or "DAT file opener" download. Since no single tool can open every DAT file, many of these are adware bundles or simply rename the file. The tools named above, downloaded from their official sites, are all you need.
Detecting the real file type in C#
If you handle uploads or process files automatically, never trust the extension. Read the first bytes and compare them against known signatures. This top-level program (.NET 8 or later) does exactly that:
using System.Text;
foreach (var path in args)
Console.WriteLine($"{path}: {FileSniffer.Detect(path)}");
public static class FileSniffer
{
// Name, offset of the signature, and the bytes that must appear there
private static readonly (string Name, int Offset, byte[] Magic)[] Signatures =
{
("PNG image", 0, new byte[] { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }),
("JPEG image", 0, new byte[] { 0xFF, 0xD8, 0xFF }),
("PDF document", 0, "%PDF-"u8.ToArray()),
("ZIP container (DOCX, XLSX, JAR, APK)", 0, new byte[] { 0x50, 0x4B, 0x03, 0x04 }),
("Windows executable (do not run it)", 0, "MZ"u8.ToArray()),
("SQLite database", 0, "SQLite format 3\0"u8.ToArray()),
("OLE compound file (old .doc/.xls, .msg)", 0, new byte[] { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 }),
("TNEF / winmail.dat", 0, new byte[] { 0x78, 0x9F, 0x3E, 0x22 }),
("MPEG program stream video", 0, new byte[] { 0x00, 0x00, 0x01, 0xBA }),
("gzip archive", 0, new byte[] { 0x1F, 0x8B }),
("UTF-16 text with BOM", 0, new byte[] { 0xFF, 0xFE }),
};
public static string Detect(string path)
{
Span<byte> buffer = stackalloc byte[16];
int read;
using (var stream = File.OpenRead(path))
read = stream.ReadAtLeast(buffer, buffer.Length, throwOnEndOfStream: false);
ReadOnlySpan<byte> header = buffer[..read];
// RIFF files carry their real type at offset 8: WAVE, AVI , WEBP, CDXA (Video CD)...
if (read >= 12 && header[..4].SequenceEqual("RIFF"u8))
return "RIFF container, subtype " + Encoding.ASCII.GetString(header.Slice(8, 4));
foreach (var (name, offset, magic) in Signatures)
{
if (read >= offset + magic.Length &&
header.Slice(offset, magic.Length).SequenceEqual(magic))
return name;
}
return LooksLikeText(header) ? "Probably plain text" : "Unknown binary format";
}
private static bool LooksLikeText(ReadOnlySpan<byte> bytes)
{
if (bytes.IsEmpty) return false;
foreach (byte b in bytes)
{
// Control characters other than tab, LF and CR rarely appear in text files
if (b < 32 && b is not (9 or 10 or 13)) return false;
}
return true;
}
}
It reads only 16 bytes, so it is fast even on multi-gigabyte files. The text check is a heuristic and can mislabel a binary file whose first 16 bytes happen to be printable, so treat "Probably plain text" as a hint, not proof.
The same idea is the basis of safe upload validation in web apps; How to Secure File Uploads in ASP.NET Core by Checking File Signatures shows a server-side version. Once you know the format and need to parse it field by field, BinaryReader and BinaryWriter Classes in C# is the next step.
For a quick look at a whole folder without writing a program, this PowerShell one-liner prints the first eight bytes of every DAT file in Windows PowerShell 5.1 and PowerShell 7:
Get-ChildItem *.dat | ForEach-Object {
$bytes = [System.IO.File]::ReadAllBytes($_.FullName) | Select-Object -First 8
'{0,-20} {1}' -f $_.Name, (($bytes | ForEach-Object { $_.ToString('X2') }) -join ' ')
}
ReadAllBytes loads the whole file, so switch to the C# version or Format-Hex for very large files.
Is a DAT file dangerous?
The extension itself is harmless, and most DAT files are ordinary program data. Opening one in a text editor, hex viewer or media player is safe, because those programs only read the data.
The risk comes from treating an unknown DAT file as a program. If the signature is MZ, the file is a Windows executable, whatever its name says. Don't rename it to .exe and don't run it. Scan it with Microsoft Defender (right-click → Scan with Microsoft Defender) and delete it if you weren't expecting it.
Join the conversation! Your thoughts help the community grow.