An executable file runs code; a data file stores information for programs to read
The difference comes down to what your computer does when it opens the file. When you double-click a data file — a Word document, a photo, a spreadsheet — your computer looks at the file type and hands it to the right program. Word opens .docx files. Your photo viewer opens .jpg files. The file itself just sits there holding information.
When you double-click an executable file, your computer runs the instructions inside it. An .exe file on Windows or an .app file on Mac contains code that tells your processor what to do. It doesn't need another program to interpret it. The file itself is the program.
This matters because executable files can do things data files cannot. They can create folders, delete files, change settings, install software, or connect to the internet. A data file can only exist — it cannot act on your system unless a program opens it and decides what to do with the contents.
Key Takeaways
- Executable files (.exe, .app, .msi, .dmg) contain code your computer runs directly, while data files (.docx, .jpg, .pdf, .xlsx) contain information that a program reads and displays.
- Executable files can modify your system, install software, or change settings without asking permission each time, while data files cannot act on your computer on their own.
- Your operating system marks executable files differently in file properties so you can see which files are runnable and which are just containers for information.
- Downloading an executable file from an untrusted source is riskier than downloading a data file, because the code inside can do anything the person who wrote it programmed it to do.
How your operating system tells them apart
Windows and Mac use file extensions and metadata to mark which files are executable. On Windows, .exe, .msi, .bat, .com, and .scr files are all executable. On Mac, .app, .deb, and .pkg files are executable. Linux uses executable permissions rather than extensions — a file can be executable or not regardless of its name.
You can see this in file properties. Right-click a file in Windows and select Properties. If it is executable, you will see an "Open With" option that lets you run it, and sometimes a "Compatibility" tab for running older software. Right-click a data file and you see "Open With" options for programs that can read it — but the file itself does not run.
On Mac, executable files show an icon that looks like a gear or the application name. Data files show the icon of the program that opens them — a document icon for Word files, a photo thumbnail for images. The Finder also marks executable files differently in the Get Info window, where you can see an "Execute" permission checkbox.
What executable files can do that data files cannot
An executable file can read and write to your hard drive, change system settings, install other software, create network connections, and access your camera or microphone — all without asking you each time. Once you run it, the code inside has the same permissions your user account has. If you are an administrator, the program can do almost anything.
A data file cannot do any of this. A .docx file cannot install software or change your settings. It can only exist as information. When you open it in Word, Word is the program that runs — and Word itself is an executable file. Word can do things the document cannot.
This is why your operating system treats executable files with more caution. Windows and Mac will warn you before running an executable file you downloaded from the internet. They do not warn you about opening a data file, because a data file cannot harm your system on its own.
Why this matters for security
An executable file from an untrusted source is a real security risk. If someone sends you a .exe file disguised as a game or a utility, and you run it, that code can install malware, steal your passwords, or lock your files for ransom. The file does not need your permission to do these things — it just needs you to run it once.
A data file from an untrusted source is much lower risk. A .pdf or .docx file cannot install malware or change your system settings. It can only contain information. However, some programs that open data files have vulnerabilities — a specially crafted PDF could exploit a bug in your PDF reader — but this is rare and usually patched quickly.
This is why you should be cautious about running executable files from people you do not know or websites you do not trust. Data files are safer, but the rule still applies: if you do not know where a file came from, do not open it.
Common executable file types and what they do
.exe files are Windows programs. They are the most common executable on Windows. When you install software on Windows, you usually download a .exe file and run it to start the installation.
.msi files are Windows installer packages. They contain instructions for installing software and are often more controlled than .exe files — they usually ask for administrator permission and follow Windows installation standards.
.app files are Mac applications. They are actually folders that contain code and resources, but Mac treats them as single executable files. You run them by double-clicking or dragging them to the Applications folder.
.dmg files are Mac disk images — containers that hold installer files or applications. When you open a .dmg, it mounts as a virtual disk, and you usually drag the .app inside it to your Applications folder.
.bat and .cmd files are Windows batch files. They contain a list of commands that run one after another. They are executable but usually less dangerous than .exe files because you can read the commands inside them as plain text.
.sh files are shell scripts on Mac and Linux. They contain commands that run in the terminal. Like batch files, you can read the commands inside them, but they can still do anything your user account can do.
How to check if a file is executable before you run it
On Windows, right-click the file and select Properties. Look at the file type. If it says "Application" or lists an executable extension like .exe or .msi, it is executable. If it says "Microsoft Word Document" or "JPEG Image", it is a data file.
On Mac, right-click the file and select Get Info. Look for an "Execute" permission checkbox. If it is checked, the file is executable. You can also look at the file icon — .app files have a distinctive application icon, while data files show the icon of the program that opens them.
You can also use your file manager to see file extensions. On Windows, open File Explorer, click View, and check "File name extensions". On Mac, open Finder, click Finder in the menu bar, select Preferences, and check "Show all filename extensions". This makes it easier to spot executable files by their extension.
When you need to run an executable file safely
Sometimes you need to run an executable file — to install software, update your operating system, or run a tool you trust. Before you do, check where the file came from. Download software only from the official website or a trusted app store. Windows Store, Apple App Store, and Google Play all scan applications before listing them.
If you download an executable file directly from a website, check that the website is legitimate. Look for https in the address bar and a lock icon. Check the website's domain name carefully — scammers sometimes use names that look similar to real companies.
After you download an executable file, your operating system will usually warn you before you run it. On Windows, you will see a dialog that says "Windows protected your PC" or "Do you want to allow this app to make changes to your device?" On Mac, you will see a dialog asking if you are sure you want to open the file. These warnings are there for a reason — read them and make sure you trust the file before clicking yes.
Frequently Asked Questions
Can I tell if an executable file is safe just by looking at it?
No. A malicious executable can look like a legitimate program. The only reliable way to know is to download it from an official source you trust — the software maker's website or an app store. If someone sends you an executable file, assume it is not safe unless you asked them for it and you know them well.
What happens if I accidentally run an executable file I did not mean to?
It depends on what the file does. If it is malware, it may have already started running. Close the program immediately and run a scan with your antivirus software. If it is a legitimate program, it may have started installing — you can usually stop the installation or uninstall the program afterward. If you are worried, restart your computer in Safe Mode and run a full antivirus scan.
Why do some data files have executable permissions on Mac or Linux?
On Mac and Linux, executable permissions are separate from file type. A file can be marked executable even if it is just text or data. This usually happens by accident when you download a file or copy it from another computer. You can remove the executable permission by right-clicking the file, selecting Get Info, and unchecking the Execute checkbox.
Is it safe to open a data file from someone I do not know?
It is much safer than running an executable file, but still use caution. Data files cannot install malware or change your system settings on their own. However, some programs that open data files have security vulnerabilities. If you do not trust the source, do not open it. If you do open it, make sure your software is up to date so any known vulnerabilities are patched.
Can I rename an executable file to hide what it is?
You can change the extension, but your operating system will still recognize it as executable based on the file's internal structure, not just the name. Renaming a .exe file to .txt does not make it safe to run — it is still executable code. This is actually a common malware trick, so be suspicious of files with mismatched names and extensions.