What is a CGI File?

How to Open, Edit, & Convert CGI Files

Picture of the CGI file icon

A file with the CGI file extension is a Common Gateway Interface Script file. They are text files that function as executable files under certain conditions.

CGI files are typically written in a programming language like C or Perl. You can learn about CGI programming from the About.com Web Design site.

One example is a CGI file that holds scripts that are responsible for sending email from a form on a website.

These script files are often seen in a web server's "cgi-bin" directory.

How To Open an CGI File

Since CGI files are text files, any text editor can be used to view and edit them. Notepad++ is my favorite free text editor, but the built-in Notepad program in Windows can be used to open CGI files as well.

Though it's not intended to work this way, you may sometimes try to download a file from a website but will instead get a .CGI file. For example, a bank statement or insurance bill you're downloading may come as a .CGI file instead of a PDF file (or another format like JPG, etc.).

You should be able to rename the .CGI file to the file you were intending to download, and then be able to open it like you regularly would. In this example, renaming the .CGI file to a .PDF file should let you open the PDF in a PDF viewer. The same process should work with any file in this context that's improperly named.

If you keep getting a .CGI file instead of the actual file you're after, it may be necessary to clear the browser's cache and try again. Disabling security software may be another solution if the problem persists.

Note: Still can't get your file to open? Double-check the file extension to make sure you aren't confusing a CGM (Computer Graphics Metafile), CSI, CGR (CATIA Graphical Representation), or CGZ (Cube Map) file with a file that has the .CGI extension.

If you find that an application on your PC does try to open the CGI file but it's the wrong application or if you would rather have another installed program open CGI files, see my How To Change the Default Program for a Specific File Extension guide for making that change in Windows.

How To Convert a CGI File

CGI files won't work properly on a web server if you convert it to another format. However, you can still save an open CGI file to HTML or another text-based format using a program like Notepad++.

Remember what I said above about renaming a CGI file. Doing so doesn't actually convert the CGI to PDF, JPG, etc., but instead just puts the proper file extension on the file so that the right program will recognize and open it. An actual file conversion takes place with a file converter.

Note: It's beyond the scope of this article if what you're actually looking for is information on CGI programming. For example, if you want to translate information from a CGI form into an Excel file, you can't just convert the CGI script itself into an XLSX or XLS file.

More Help With CGI Files

See Get More Help for information about contacting me on social networks or via email, posting on tech support forums, and more.

Let me know what kinds of problems you're having with opening or using the CGI file and I'll see what I can do to help.