How to determine file type without extension

Imagine that you receive mail from your friends or colleagues, and as an attachment they sent you some kind of document in the form of a file attached to the letter, which contains the information you need. You save this file to your computer, but you see that instead of the usual icons for some program (Word, Excel, PDF, etc.), there is no icon, and Windows thinks that this is some kind of file with an unknown format. This often happens due to the fact that the file, while being attached to a letter by the sender (or when the file is saved to the computer by the recipient), loses its extension, and the Windows operating system ceases to understand what type of file is in front of it, and accordingly does not know which program you need to open such a file. You can read what a file extension is, and how to display and hide them in different versions of Windows.

The second most common reason for losing a file extension is careless renaming of a file, when you have Windows set to display extensions of all known file types, and when you try to rename a file, you accidentally erase the file extension and end up with a document of unknown origin that you can no longer double-open with a click of the mouse. For example, your file was called “Letter.doc”, which used to be easily opened using Word, but after renaming it became known as “Letter for work”. Please note that the file no longer has the ".doc" extension that was accidentally erased when changing the file name, and now the file will not be opened by double-clicking, but will try to ask you what program to open this file with.

It's good if you know exactly what type of file is in front of you, and you can simply add the desired extension to it, for example, doc or xls, so that it automatically opens by double-clicking on it. In a separate article you can read about. But what if you have a file in front of you whose type you don’t know? There are at least two ways to find out what type of file you have and give it the correct extension.

In this article, we will conduct an experiment - we will take several ready-made files of different formats that we discussed in the above article, erase their extensions, as if they were lost or accidentally deleted, and try to find out what type each file has and what type it needs to be added extension to open it easily.

Several files will be involved in our experiment:

  1. Bonnie Tyler - Turn around.mp3 - song in mp3 format
  2. bonus.mp4 - small video in mp4 format
  3. KeePass-2.28.exe - installation file for the KeePass program (I will tell you about this wonderful program in one of the following articles)
  4. math.zip - zip archive
  5. Point Break.avi - a small video in avi format
  6. Tulips.jpg - picture with tulips
  7. Report.ppt - presentation made in MS PowerPoint 2003
  8. Materials for the meeting.pptx - presentation made in MS PowerPoint 2007
  9. Letter.doc - text file made in MS Word 2003
  10. Order.docx - text file made in MS Word 2007
  11. Application 4.rar - rar archive
  12. resolution.pdf - file in pdf format
  13. Correspondence table.xlsx - data file made in the spreadsheet editor MS Excel 2007
  14. Tabular data.xls - data file made in the spreadsheet editor MS Excel 2003

In the picture below, all files have their own extensions (highlighted by frames with red edges):

We delete all file extensions, and after that all program icons with which you can open these files disappear. On Windows XP it looks like this:

In Windows 7 it looks a little different, but the meaning is the same - the operating system does not know which program to open these files.

Now, when we try to open any file, Windows will prompt us to first select the program that needs to open this file:

And here you need to be careful, since the wrong choice of program for a given file type will lead to the fact that the file will not open, and the program will generate an error, and the wrong association of the program for opening it will be assigned to this file.

Sometimes we can guess what type of file we have and what extension it should have by looking at the file name. But we will take the case when this is impossible.

So, we have a bunch of files with unknown formats and extensions, and we need to understand what these files are.

The first way to find out what type of file is in front of us is to look at the contents of these files using simple text editors, for example, Notepad, or better yet, either using the built-in viewers of various file managers, such as Total Commander or Far, or using free advanced text editor Notepad++. I recommend that you download and install it as it has many advantages over a regular notepad.

We take the first file “Bonnie Tyler - Turn around”, select Notepad++ in the list of programs to open (if you haven’t installed it, use regular Notepad, but Notepad++ is still better, because when opening large files Notepad simply freezes), and we see some krakozyabry:

This should not confuse you, since to determine the file type it is enough to look at the first line of the file contents. Here you can see that the file begins with the letters “ID3″.

So, remember that if inside a file its contents begin with “ ID3“, then this is an mp3 music file, and this is the extension that needs to be assigned to it. After specifying the extension, the file will be recognized by the system as music, and you will be able to listen to it.

Open the second “bonus” file with the same Notepad++ program and look at its contents:

As we can see in the first line of the file contents, it is repeatedly mentioned that this is an mp4 video file (highlighted in red in the screenshot above). And in general, if you see text like “ ftypmp42“, then, as a rule, this is a video file in mp4 format.

Performing the same operation of viewing the contents with all other files, we obtain the following information:

  1. When opening the contents of the KeePass-2.28 file, you can see that the file begins with the letters MZ - this is a sign that this is an executable file.
  2. When opening the contents of the math.zip file, you can see that the file begins with the letters PK - this tells us that this file is an archive. Considering that Rar archives have a different entry in the file content, it is most likely a Zip archive, but be careful and pay attention to point 6 below.
  3. When opening the contents of the Point Break file, in the very first line we see a hint that this is a video file in avi format.

  1. When opening the contents of the Tulips file, we see two words that define the file format - at the beginning of the line “YaShya” and then “Exif”. These words define the graphic format of the file, in particular jpg, and in this case we are absolutely sure that this is an image file.

  1. Regarding the MS Office 2003 files “Report”, “Letter” and “Tabular Data” - all of them in the internal content begin with “RP”, so it is quite difficult to immediately determine which of them was made in Word, Excel or PowerPoint. The only thing you can be sure of is that these files belong to one of the MS Office applications version 2003 and lower. Therefore, to open these types of files, you can use a search of three extensions, starting with “doc”, then “xls”, then “ppt”. Typically, one of these will do.
  2. The files “Meeting Materials”, “Order”, “Correspondence Table” are a little more complicated - since they are made in MS Office 2007 applications, they are essentially archives, and therefore at the beginning of their contents you will see the same letters as in the Zip archive these are the letters “PK”. However, further in the same line you can see the line .xml, it is this that will tell us that this is not just an archive, but a document from the MS Office series. Just as in the previous paragraph, you can use sequential enumeration of the three “docx” extensions ", then "xlsx", then "pptx". One of them should do.
  1. When we open the contents of the “Appendix 4” file, we see that it begins with the word “Rar” - this is the simplest indication that we have an archive in rar format.
  2. When you open the contents of the “resolution” file, you can see from the very beginning what kind of file it is, since it starts with the line “%PDF-1.3”. The numbers may vary, but nevertheless the abbreviation pdf is usually present and indicates the file format.

The second method of determining the file type requires an Internet connection, and it is also desirable that the file size be small, since we will use an Internet service to determine the file format.

We click on the “select file” button, indicate our file for analysis (I’ll try to analyze one of the complex “Meeting Materials” files to see if this analyzer can cope and understand that this file was created in MS PowerPoint 2007 (in it had a pptx extension, and we removed it during our experiment).After selecting the file, click the “Analyze” button and get the following result:

As you can see, the service determined with 97% probability that this is a PowerPoint file with the pptx extension. And since this file is also a container archive containing other files inside it, the analyzer also indicated a three percent chance that it could be a zip archive.

Let’s also try to check whether this service can determine the type of our “resolution” file, from which we have erased the pdf extension. We upload the file to the service, click the “Analyze” button and see that the service coped with the task perfectly:

As I already said, the disadvantage of this service may be that in order to analyze a file, it needs to download it completely, and if you have a large file, then this process may take a long time, or even not be completed at all. Therefore, if unidentified files are large, try first using the first method to determine its type, namely, viewing the contents of the file through the file manager or Notepad++ editor.

You can, of course, use special programs to determine the file type, for example, File Type Verificator, but in my opinion, it will be much easier and faster to use one of the two methods proposed above.

So, dear site visitors, today we have discussed how you can determine the format (type) of a file if its extension has been lost. If you have any questions, please ask them in the comments to this article.

Post navigation