What Is a CGI File?

Use any text editor to open a Common Gateway Interface script

In This Article

Jump to a Section

What to Know

  • A CGI file is a Common Gateway Interface script.
  • Open one with any text editor, such as Notepad++.
  • Convert to other text-based formats with that same program.

This article explains what a CGI file is, how to open one on your computer, and how to convert one to a different format.

What Is a CGI File?

A file with the CGI file extension is a Common Gateway Interface script. They are text files, but since they're written in a programming language like C or Perl, they can function as executable files under certain conditions.

One example is a CGI file that holds scripts that are responsible for sending emails from a form on a website. These are often seen in a web server's "cgi-bin" directory.

CGI files that open with Notepad++

How to Open a CGI File

Since CGI files are text files, the built-in Notepad program in Windows, as well as other text editors, can be used to view and edit them.

Although it's not intended to work this way, you might 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 this file type instead of a PDF (or some other format like JPG, etc.).

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

Renaming like this doesn't actually convert the file to a new format. It just changes which program opens the file. Since, in this example, the document should be a PDF, renaming it is just putting the correct file extension on the file.

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 your firewall or security software may be another solution if the problem persists, just remember that this should only be a temporary solution.

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 one to HTML or another text-based format using a text editor I linked to above.

Remember what was above about renaming a CGI file. Doing so doesn't actually convert it, 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.

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.

Still Can't Open It?

Double-check the file extension to make sure you aren't confusing a CGM (Computer Graphics Metafile), CSI, CGR (CATIA Graphical Representation), CGF (Crytek Geometry Format), or CGZ (Cube Map) file with one that has the .CGI extension.

As you can see, file extensions used between different formats can look an awful lot alike, but that doesn't necessarily mean that they're opened or converted in the same way.

Was this page helpful?