TMP File Documentation
Summary
A Temporary File is scratch data a program or the operating system writes while it works: autosave snapshots, installer payloads, staged downloads, print-spool buffers. TMP is a naming convention, not a format, so a .tmp file has no fixed structure and its MIME type is the generic application/octet-stream. If the program that made it is still running, leave it alone; if it is a leftover from a closed or crashed program, it is almost always safe to delete.
Technical details
| Feature | Value |
|---|---|
| Full name | Temporary File |
| File extension | .tmp (also .temp) |
| MIME type | application/octet-stream |
| Format type | None — naming convention; contents are application-defined |
| Developer | N/A — generic OS/application convention |
| Introduced | 1980s (MS-DOS and early Unix) |
| Magic number | None of its own — inherits the header of whatever was written |
| Category | System / scratch files |
| Created by | Operating systems, installers, Office apps, browsers, updaters |
| Typical location (Windows) | %TEMP% = C:\Users\<name>\AppData\Local\Temp |
| Typical location (Unix) | /tmp |
| Windows naming API | GetTempFileName() → names like tmpXXXX.tmp |
| Temporary / disposable | Yes — normally deleted by the creating program on exit |
| Safe to delete | Yes, when not in use by a running program |
| Built-in cleanup (Windows) | Storage Sense; Disk Cleanup (cleanmgr.exe) |
| Encryption | Depends entirely on the creating application |
| Recoverable content | Sometimes — if the file is a renamed known format (PDF, JPEG, ZIP) |
| Related extensions | .temp, .bak, .part, .crdownload, ~tmp |
What is a TMP file?
TMP (and its longer spelling .temp) is a naming convention, not a file format. A .tmp file is scratch data that a program or the operating system writes while it is working and expects to throw away afterwards. Because the extension only signals “this is temporary”, two .tmp files from different programs can have nothing in common: one may be a half-written document, another a raw memory buffer, another a renamed archive. The convention goes back to MS-DOS and early Unix in the 1980s, and there is no single application that “opens TMP files” because there is no single thing inside them.
This is why the honest technical answer to “what is in my .tmp file?” is: whatever the program that created it was writing. The extension carries no header, no fixed byte layout and no reliable magic number of its own. To find out what a specific .tmp actually holds, you inspect its first bytes rather than trusting the name.
Why programs create temporary files
Temporary files exist for a few concrete reasons. A program buffers data to disk when it does not fit comfortably in memory. Installers unpack their payload to .tmp files before placing the final files (NSIS and MSI-based installers do this routinely). Applications write a new version of a document to a temporary file first, then rename it over the original, so a crash mid-save cannot destroy the old copy. And editors keep autosave or crash-recovery snapshots as temporary files. Microsoft Word is the textbook case: while you edit, it creates owner/lock files such as ~$document.docx and scratch .tmp files in the document’s folder.
On Windows the API GetTempFileName() generates the familiar names like tmpA1B2.tmp in the folder pointed to by the %TEMP% environment variable, which defaults to C:\Users\<name>\AppData\Local\Temp. On Unix-like systems the equivalent staging area is /tmp. Normally the creating program deletes its temporary files when it exits, so the ones that pile up are leftovers from crashes, killed processes or sloppy cleanup.
How to tell what a TMP file really is
Since a .tmp has no signature of its own, identification means reading the bytes it inherited from its real content. Open the file in a text or hex editor such as Notepad++, or run the file command on macOS and Linux, and check the start of the file against known magic numbers. 25 50 44 46 (%PDF) means it is really a PDF; FF D8 FF is a JPEG; 50 4B 03 04 (PK) is a ZIP-based file such as a DOCX or ordinary ZIP; D0 CF 11 E0 is a legacy Office document. If you find a match, copy the file and change its extension to the real one, and it will open normally. If the first bytes are not a recognisable format, the file is most likely an internal buffer that is useful only to the program that wrote it.
Whether TMP files are safe to delete
A .tmp file that no running program is using is safe to delete. The safe procedure is to close your applications (or reboot, which releases file locks), then run Storage Sense or Disk Cleanup on Windows to clear the Temp folders, rather than deleting files one at a time. Windows will refuse to delete a .tmp that an application currently has open, with a “file in use” error; that refusal is the system protecting an active file, and those are the ones to leave alone.
The real risk of deleting temporary files is operational, not security: removing a .tmp that a program is actively writing can crash the program or corrupt the document being edited. Temporary files themselves are inert data and cannot run on their own. Malware does sometimes drop executable payloads into the Temp folder (which is why antivirus tools watch %TEMP%), but that is a program placed there, not the ordinary .tmp buffers your applications leave behind.
Recovering unsaved work from a TMP file
After a crash, a leftover .tmp in a document’s folder occasionally holds a full copy of the work. The more reliable route is the application’s own recovery: in Word, File → Info → Manage Document → Recover Unsaved Documents opens the autosave snapshots (Word’s .asd files) directly. Failing that, you can try the byte-inspection trick above: if a scratch .tmp starts with PK, renaming it to .docx may open it; if it starts with D0 CF 11 E0, try .doc. This works only when the temporary file happened to contain a complete document rather than a partial buffer.
References
- Microsoft Learn — GetTempFileName (temporary file naming)
- Microsoft Support — Free up drive space (Storage Sense / Disk Cleanup)
- Microsoft Learn — How Word creates temporary files
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.