How To Find The Encoding Type Of A File In Mac, Windows And Linux

Ashok Raja T
Technology Specialist
June 15, 2020
Rate this article
Views    13989

Finding the encoding type of a file differs from Operating System to Operating System. In this article let us see how to find the file encoding type in Mac OS, Windows and in Ubuntu Linux.

Finding File Encoding Type In Mac

Finding the encoding type in Mac is much easier. To find the encoding type of the file, execute the below command in terminal
file -I "file name"

Finding File Encoding Type In Windows

Usually, we try to figure it out by opening it up with Notepad++ and find the encoding. But nodepad++ won’t provide you the exact encoding. To get the exact encoding you need the “file” executable that is available in other Operating Systems like Mac and Linux. This would be available already in your PC if you have installed git for windows. If you haven’t installed git in your PC, you can install it from this link.

Now you can execute the below command it terminal to find the encoding type.

file --mime-encoding "file name"

This would provide you an output similar to the one below.

If you have tried in nodepad++ for the same file, it may show a different encoding name.
Find the screenshot below for the same file.

Find File Encoding Type in Linux

The same command that we tried for Windows works in Linux. To find the encoding type of a file, execute the below command in terminal.

file --mime-encoding "file name"

You can expect an output similar to the one below.

Subscribe To Our Newsletter
Loading

Leave a comment