User Agents

Web browsers and everyday web tech, explained

Safe File Extension List: Guide to Secure File Types

· 6 min read · Extensions

In this article
  1. Understanding File Extensions and Execution
  2. Generally Low-Risk Data Extensions
  3. High-Risk Executable Extensions
  4. The Danger of Double Extensions
  5. How to Verify File Safety
  6. Common Misconceptions About File Safety
  7. Frequently Asked Questions

There is no absolute "safe" file extension list because any file can potentially be used as a vector for an attack, but generally, non-executable data files like .txt, .jpg, .png, and .pdf are safer than executable files like .exe, .bat, or .scr. The primary distinction lies in whether the file contains instructions for the computer to run (code) or simply data for a program to display.

Understanding File Extensions and Execution

A file extension is the suffix at the end of a filename, following the dot, which tells the operating system which application should open the file. For example, .docx tells Windows or macOS to use a word processor. However, the extension is merely a label; it does not define the actual content of the file. A malicious actor can rename a dangerous executable file (like a script) to look like a harmless image or document to trick a user into opening it.

The core risk associated with file extensions is "execution." When you run an executable file, you are giving that file permission to perform actions on your system, such as modifying registry keys, deleting files, or establishing a network connection to a remote server. Data files, by contrast, are meant to be read by a parser. While parsers themselves can have vulnerabilities (bugs that allow a specially crafted data file to trigger code execution), the inherent risk is significantly lower than running a program designed specifically to execute commands.

Generally Low-Risk Data Extensions

These extensions are typically used for storing information rather than executing programs. While not immune to risk, they are the safest categories for general use:

  • Plain Text: .txt, .csv, .log. These contain only characters and no formatting or embedded scripts, making them among the safest files possible.
  • Images: .jpg, .jpeg, .png, .gif, .webp. These are standard formats for visual data. While "steganography" can hide code inside images, the image itself cannot run as a program.
  • Documents: .pdf, .rtf. These are widely used for sharing information. Note that PDFs can contain embedded links or JavaScript, which is why updating your PDF reader is critical.
  • Audio and Video: .mp3, .wav, .mp4, .mkv. These files contain compressed media streams. Like images, they are data-driven and require a media player to function.
  • Archives: .zip, .7z, .rar. These are containers. The archive itself is generally safe, but the contents inside the archive can be anything, including dangerous executables.

High-Risk Executable Extensions

You should exercise extreme caution when encountering these extensions, especially if they arrive via email or are downloaded from untrusted websites. These files are designed to run code directly on your hardware:

  • System Executables: .exe, .com, .msi. These are standard Windows installers or programs. They have full access to system resources once launched.
  • Script Files: .bat, .cmd, .ps1, .vbs, .sh. These are text files containing a series of commands for the command prompt or PowerShell. They can automate the installation of malware or the deletion of system files.
  • Screen Savers: .scr. These are effectively .exe files renamed to look like screen savers. They are a common vehicle for trojans.
  • Shortcut Files: .lnk. While common, a modified shortcut can be programmed to launch a hidden malicious command in the background while appearing to open a legitimate folder.
  • Java Executables: .jar. These run within the Java Runtime Environment and can perform complex operations on the host machine.

The Danger of Double Extensions

One of the most common tricks used in phishing attacks is the "double extension." Because many operating systems hide known file extensions by default, a file named invoice.pdf.exe might appear to the user as invoice.pdf. The user believes they are opening a document, but they are actually launching an executable program.

To counter this, users should change their folder settings to "Show file extensions for known file types." This reveals the true nature of the file. If you see a file that ends in .exe, .scr, or .vbs but is named like a document (e.g., payment_details.txt.vbs), it is almost certainly malicious. Legitimate software rarely uses double extensions in this manner.

How to Verify File Safety

Since extensions can be faked, relying on the label alone is insufficient. To truly determine if a file is safe, follow these verification steps:

  1. Check the Source: Ask yourself if you were expecting the file. An unsolicited "Shipping Invoice" from an unknown sender is a red flag, regardless of the extension.
  2. Use a Hash Checker: For software downloads, developers often provide a SHA-256 or MD5 hash. By running the downloaded file through a hash calculator, you can ensure the file hasn't been tampered with by a third party.
  3. Scan with Multi-Engine Tools: Instead of relying on a single antivirus, upload suspicious files to a multi-engine scanner like VirusTotal. This checks the file against dozens of different security databases simultaneously.
  4. Analyze in a Sandbox: For advanced users, opening a file in a virtual machine or a sandbox environment isolates the file from the main operating system. If the file attempts to encrypt your drive or contact a malicious IP, it happens inside the isolated container without affecting your actual computer.

Common Misconceptions About File Safety

A frequent misconception is that .pdf or .docx files are 100% safe because they are "documents." In reality, modern document formats are highly complex. For example, Microsoft Office documents (.docm, .xlsm) can contain "Macros." Macros are small programs written in VBA (Visual Basic for Applications) that can automate tasks. Attackers use macros to download malware from the internet the moment the user clicks "Enable Content" at the top of the document.

Another misconception is that files from "trusted" cloud services like Google Drive or Dropbox are automatically safe. These services act as delivery mechanisms; they do not necessarily vet every file uploaded by their users. A malicious file hosted on a reputable cloud platform is still a malicious file.

Frequently Asked Questions

Is a .zip file safe to download?

A .zip file is a container, not a program. Downloading the archive itself is generally safe, but the danger lies in what is inside. Once you extract the contents, you must apply the same scrutiny to the resulting files. If a .zip contains .exe or .js files you weren't expecting, do not run them.

Can a .jpg file contain a virus?

While a .jpg cannot "run" like a program, it can be used in "buffer overflow" attacks. If a specific image viewer has a security flaw, a specially crafted image file can trigger that flaw to execute code. Keeping your software updated prevents these rare vulnerabilities from being exploited.

What should I do if I see a .bin file?

A .bin file is a binary file. These are generic and can be anything from a firmware update to a raw data dump. Because they are ambiguous, they should be treated with caution. Only open .bin files if you know exactly which program is required to read them and you trust the source.

Why do some files have no extension at all?

Some systems, particularly Linux and macOS, do not rely on extensions to identify file types; they use "magic bytes" (headers) at the start of the file. On Windows, a file without an extension will prompt you to choose a program to open it. These are not inherently dangerous, but they are ambiguous, which warrants a scan before opening.

Are .iso files safe?

An .iso file is a disk image (a virtual copy of a CD or DVD). Like .zip files, the .iso itself is data, but mounting it allows you to access the files inside. Attackers often use .iso files to bypass some email filters that block .exe files, as the executable is hidden inside the disk image.