User Agents

Web browsers and everyday web tech, explained

How to Get a File Extension on Windows, Mac, and Mobile

· 5 min read · Extensions

In this article
  1. How File Extensions Work
  2. Revealing Extensions on Windows
  3. Revealing Extensions on macOS
  4. Checking Extensions on Mobile Devices
  5. Common File Extension Categories
  6. Safety and Security Risks
  7. Frequently Asked Questions

To get the extension of a file, look at the characters following the final period in the filename, such as the ".jpg" in "image.jpg". If the extension is hidden, you must adjust your operating system's folder settings to "Show file extensions" to make them visible.

How File Extensions Work

A file extension is a suffix added to the end of a computer file name. It typically consists of a period followed by three or four alphanumeric characters. This suffix serves as a metadata tag that tells the operating system which application is best suited to open the file. For example, when you double-click a file ending in ".docx", the system recognizes it as a Microsoft Word document and launches the corresponding software.

While the extension helps the OS choose a program, it does not actually define the internal structure of the data. The data is stored in a specific binary format; the extension is simply a label. This is why changing a ".txt" extension to ".jpg" will not turn a text document into a photo; it will instead likely cause the system to produce an error message stating the file is corrupted or the format is unsupported.

Revealing Extensions on Windows

By default, modern versions of Windows hide extensions for known file types to make filenames look cleaner. To see them, follow these steps:

  1. Open File Explorer by clicking the folder icon in your taskbar or pressing Windows Key + E.
  2. Depending on your version of Windows, the method differs slightly:
    • Windows 11: Click the View dropdown menu at the top of the window, hover over Show, and select File name extensions.
    • Windows 10: Click the View tab in the top ribbon and check the box labeled File name extensions.
  3. The extensions will now appear immediately after the filenames in all folders.

Revealing Extensions on macOS

Apple's macOS also hides extensions by default for many common files. You can reveal them globally or for a specific file:

To show all extensions:

  1. Open Finder.
  2. Click Finder in the top menu bar and select Settings (or Preferences on older versions).
  3. Navigate to the Advanced tab.
  4. Check the box that says Show all filename extensions.

To check a single file:

  1. Right-click (or Control-click) the file.
  2. Select Get Info.
  3. Look under the Name & Extension section to see the full filename.

Checking Extensions on Mobile Devices

Mobile operating systems like Android and iOS handle files differently than desktop OSs, often hiding extensions entirely within their primary gallery or music apps. To find an extension on mobile, you must use a file management app.

  • Android: Open the Files by Google app (or the native "My Files" app). Navigate to the file, tap the three-dot menu next to the file, and select Details or File info. The full name including the extension will be listed there.
  • iOS (iPhone/iPad): Open the Files app. Long-press on the file in question and select Get Info. The extension will be displayed in the file details summary.

Common File Extension Categories

Understanding the different types of extensions can help you identify what a file is even if you don't have the right software installed. Most extensions fall into these broad categories:

  • Documents: ".pdf" (Portable Document Format), ".docx" (Word), ".txt" (Plain Text), ".rtf" (Rich Text Format).
  • Images: ".jpg" or ".jpeg" (Joint Photographic Experts Group), ".png" (Portable Network Graphics), ".gif" (Graphics Interchange Format), ".svg" (Scalable Vector Graphics).
  • Audio: ".mp3" (MPEG Audio Layer III), ".wav" (Waveform Audio File Format), ".aac" (Advanced Audio Coding).
  • Video: ".mp4" (MPEG-4), ".mov" (QuickTime Movie), ".avi" (Audio Video Interleave), ".mkv" (Matroska Video).
  • Compressed/Archives: ".zip" (Zipped), ".rar" (Roshal Archive), ".7z" (7-Zip), ".tar" (Tape Archive).
  • Executables: ".exe" (Windows Executable), ".app" (macOS Application), ".msi" (Windows Installer).

Safety and Security Risks

File extensions are a primary vector for malware and phishing attacks. A common tactic used by attackers is the "double extension" trick. For example, a file might be named invoice.pdf.exe. If the user has "Hide extensions for known file types" enabled in Windows, the file will appear as invoice.pdf.

The user thinks they are opening a PDF document, but they are actually running an executable (".exe") program that can install ransomware or spyware. To protect yourself, always enable file extensions in your system settings so you can verify exactly what you are clicking. Be extremely cautious of any file that ends in ".exe", ".bat", ".scr", or ".vbs" if you were expecting a document or an image.

Frequently Asked Questions

Can I change a file extension to open it in a different program?

Changing the extension manually (renaming the file) does not convert the file's internal format. While it might trick the OS into trying to open it with a different program, the program will likely fail to read the data. To change a file type, you should use a "Save As" function in a compatible app or a dedicated file converter.

What happens if a file has no extension?

If a file lacks an extension, the operating system does not know which program to use by default. When you double-click it, the OS will usually ask you to "Select an app to open this file." You can then manually browse for the program you believe created the file.

Is .jpeg the same as .jpg?

Yes. Both refer to the same image compression format. The difference is historical; older versions of Windows required a three-letter extension, so ".jpeg" was shortened to ".jpg". Modern systems treat them identically.

Why does my computer say the file is corrupted after I renamed the extension?

The file is likely not corrupted, but the software you are using is expecting a specific data structure associated with that extension. Because you only changed the label and not the actual data, the software cannot find the expected markers and reports a corruption error.