- Common File Types and File Extensions
- Common File Types
- Web Pages
- Images
- GIF
- JPG
- PNG
- Scripts
- .js (JavaScript)
- .java or .class
- Other File Types
- .php and .php3
- .shtm and .shtml
- .asp
- .cfm and .cfml
- Common MIME types
- Found a content problem with this page?
- Types of HTML file extensions
- HTML (.html)
- SHTML (.shtml)
- Dynamic HTML (.dhtml)
- Extensible HTML (.xhtml)
- Benjamin QoChuk, PhD
- HTML
- Time and Space Complexity of Selection Sort on Linked List
- Different ways to convert array to set in C++
Common File Types and File Extensions
Jennifer Kyrnin is a professional web developer who assists others in learning web design, HTML, CSS, and XML.
Even though most websites are run on Unix web servers that, like Macs, don’t require file extensions, these extensions help differentiate files. A file name and extension indicates the type of file, how the web server uses it, and how you can access it.
Common File Types
The most common files on web servers are:
Web Pages
Two extensions are standard for web pages: .html and .htm. There’s no difference between them, and you can use either on most web servers.
As the original extension for HTML pages on Unix web hosting machines, .html indicates a file that uses HTML (HyperText Markup Language) or XHTML (EXtensible HyperText Markup Language).
Windows/DOS required three-character file extensions, which gave rise to the .htm extension. This also references HTML and XHTML files and can be used on any web server, regardless of the operating system.
The default page in a directory on most web servers typically has an index.htm or index.html extension. Visitors to your website don’t have to enter either of these two extensions in the address bar, as long as you’ve given the home page one of them. For example, http://thoughtco.com/index.htm goes to the same place as http://thoughtco.com.
Some web servers are set up to call a home page default.htm, which you can change if you have access to the server configuration.
Images
The most common types of image files online are GIF, JPG, and PNG. All browsers can display them, and web designers use the format that’s best for their particular applications.
GIF
GIF (graphic interchange format) is a lossless format first developed by CompuServe for both animated and static images. It works best for images with flat colors and short animated snippets. It offers the ability to index colors to make sure that they contain only web-safe colors (or an otherwise small palette of colors), keeping file size small.
JPG
The JPG (aka JPEG) format was created by the Joint Photographic Experts Group (hence, the acronym) for photographic images. If an image has photographic qualities without expanses of flat color, it is well suited to this file format. A photograph saved with the .jpg or .jpeg extension is typically compressed, yielding a smaller file size than a .gif file.
PNG
The PNG (Portable Network Graphic) format was made for the web, with better compression, color, and transparency than GIF files. PNGs don’t have to have the .png extension, but that’s how you’ll most often see them.
Scripts
Scripts are files that activate dynamic actions on websites. There are many types, but you’ll see the following most often.
.js (JavaScript)
You can load JavaScript files into the web page itself, or you can place JavaScript in an external file and call it from there. If you write your JavaScript into the web page, you won’t see the .js extension, because it’s part of the HTML file.
.java or .class
These two extensions are often associated with Java programs. Although you probably won’t come across a .java or .class extension on a web page, these files are often used to generate Java applets for web pages.
Java is a completely different programming language from JavaScript.
Other File Types
A few other extensions you might encounter refer to files that typically augment function and flexibility on a website.
.php and .php3
The .php extension is nearly as common as .html and .htm on web pages. This extension indicates a page written with PHP, an open-source, easy-to-learn language that facilitates scripting, macros, and includes on a website.
.shtm and .shtml
These denote files that use server-side includes—coding that lives in separate files that are called into the page. Essentially, this allows you to include one web page inside another and add macro-like actions to your websites.
.asp
This extension denotes an Active Server Page. ASP provides scripting, macros, and includes, along with database connectivity and more. It is most often found on Windows web servers.
.cfm and .cfml
These extensions are given to ColdFusion files. ColdFusion is a powerful server-side content management tool that brings macros, scripting, and more to your web pages.
Common MIME types
This topic lists the most common MIME types with corresponding document types, ordered by their common extensions.
The following two important MIME types are the default types:
- text/plain is the default value for textual files. A textual file should be human-readable and must not contain binary data.
- application/octet-stream is the default value for all other cases. An unknown file type should use this type. Browsers are particularly careful when manipulating these files to protect users from software vulnerabilities and possible dangerous behavior.
IANA is the official registry of MIME media types and maintains a list of all the official MIME types. This table lists important MIME types for the Web:
Extension | Kind of document | MIME Type |
---|---|---|
.aac | AAC audio | audio/aac |
.abw | AbiWord document | application/x-abiword |
.arc | Archive document (multiple files embedded) | application/x-freearc |
.avif | AVIF image | image/avif |
.avi | AVI: Audio Video Interleave | video/x-msvideo |
.azw | Amazon Kindle eBook format | application/vnd.amazon.ebook |
.bin | Any kind of binary data | application/octet-stream |
.bmp | Windows OS/2 Bitmap Graphics | image/bmp |
.bz | BZip archive | application/x-bzip |
.bz2 | BZip2 archive | application/x-bzip2 |
.cda | CD audio | application/x-cdf |
.csh | C-Shell script | application/x-csh |
.css | Cascading Style Sheets (CSS) | text/css |
.csv | Comma-separated values (CSV) | text/csv |
.doc | Microsoft Word | application/msword |
.docx | Microsoft Word (OpenXML) | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
.eot | MS Embedded OpenType fonts | application/vnd.ms-fontobject |
.epub | Electronic publication (EPUB) | application/epub+zip |
.gz | GZip Compressed Archive | application/gzip |
.gif | Graphics Interchange Format (GIF) | image/gif |
.htm , .html | HyperText Markup Language (HTML) | text/html |
.ico | Icon format | image/vnd.microsoft.icon |
.ics | iCalendar format | text/calendar |
.jar | Java Archive (JAR) | application/java-archive |
.jpeg , .jpg | JPEG images | image/jpeg |
.js | JavaScript | text/javascript (Specifications: HTML and RFC 9239) |
.json | JSON format | application/json |
.jsonld | JSON-LD format | application/ld+json |
.mid , .midi | Musical Instrument Digital Interface (MIDI) | audio/midi , audio/x-midi |
.mjs | JavaScript module | text/javascript |
.mp3 | MP3 audio | audio/mpeg |
.mp4 | MP4 video | video/mp4 |
.mpeg | MPEG Video | video/mpeg |
.mpkg | Apple Installer Package | application/vnd.apple.installer+xml |
.odp | OpenDocument presentation document | application/vnd.oasis.opendocument.presentation |
.ods | OpenDocument spreadsheet document | application/vnd.oasis.opendocument.spreadsheet |
.odt | OpenDocument text document | application/vnd.oasis.opendocument.text |
.oga | OGG audio | audio/ogg |
.ogv | OGG video | video/ogg |
.ogx | OGG | application/ogg |
.opus | Opus audio | audio/opus |
.otf | OpenType font | font/otf |
.png | Portable Network Graphics | image/png |
Adobe Portable Document Format (PDF) | application/pdf | |
.php | Hypertext Preprocessor (Personal Home Page) | application/x-httpd-php |
.ppt | Microsoft PowerPoint | application/vnd.ms-powerpoint |
.pptx | Microsoft PowerPoint (OpenXML) | application/vnd.openxmlformats-officedocument.presentationml.presentation |
.rar | RAR archive | application/vnd.rar |
.rtf | Rich Text Format (RTF) | application/rtf |
.sh | Bourne shell script | application/x-sh |
.svg | Scalable Vector Graphics (SVG) | image/svg+xml |
.tar | Tape Archive (TAR) | application/x-tar |
.tif , .tiff | Tagged Image File Format (TIFF) | image/tiff |
.ts | MPEG transport stream | video/mp2t |
.ttf | TrueType Font | font/ttf |
.txt | Text, (generally ASCII or ISO 8859-n) | text/plain |
.vsd | Microsoft Visio | application/vnd.visio |
.wav | Waveform Audio Format | audio/wav |
.weba | WEBM audio | audio/webm |
.webm | WEBM video | video/webm |
.webp | WEBP image | image/webp |
.woff | Web Open Font Format (WOFF) | font/woff |
.woff2 | Web Open Font Format (WOFF) | font/woff2 |
.xhtml | XHTML | application/xhtml+xml |
.xls | Microsoft Excel | application/vnd.ms-excel |
.xlsx | Microsoft Excel (OpenXML) | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
.xml | XML | application/xml is recommended as of RFC 7303 (section 4.1), but text/xml is still used sometimes. You can assign a specific MIME type to a file with .xml extension depending on how its contents are meant to be interpreted. For instance, an Atom feed is application/atom+xml , but application/xml serves as a valid default. |
.xul | XUL | application/vnd.mozilla.xul+xml |
.zip | ZIP archive | application/zip |
.3gp | 3GPP audio/video container | video/3gpp ; audio/3gpp if it doesn’t contain video |
.3g2 | 3GPP2 audio/video container | video/3gpp2 ; audio/3gpp2 if it doesn’t contain video |
.7z | 7-zip archive | application/x-7z-compressed |
Found a content problem with this page?
This page was last modified on Apr 10, 2023 by MDN contributors.
Types of HTML file extensions
There are 4 different types of HTML file extensions and the extension denote a specific feature enabled in the HTML web page. In this article, we have explored all different types of HTML file extensions in depth.
There are 4 types of HTML files:
We will go over each type of HTML file extension now.
HTML (.html)
This is the basic version of HTML (HyperText Markup Language).
The file extension of this type is .html.
SHTML (.shtml)
SHTML is an extension of HTML with Server Side Include (SSI) enabled. SSI enables the HTML page to:
- Execute Server side scripts
- Load common include files faster and hence, optimize HTML code.
The file extension of this type is .shtml.
Dynamic HTML (.dhtml)
Dynamic HTML is an extension of HTML that supports dynamic features such as animation, dynamic menus and much more.
The file extension of this type is .dhtml.
Extensible HTML (.xhtml)
Extensible HTML is a variant of HTML that is strict in its rules and has a more standarized format.
The file extension of this type is .xhtml.
Following table summarizes the different HTML files:
With this article at OpenGenus, you must have the complete idea of different HTML files.
Benjamin QoChuk, PhD
Benjamin QoChuk is a Computer Science Researcher, Inventor and Author. His educational background include Bachelors at Vanderbilt University and PhD in Computer Science at Peking University.
OpenGenus Tech Review Team
HTML
Time and Space Complexity of Selection Sort on Linked List
In this article, we will learn about the space and time complexity of the Merge sort algorithm on Linked List using Mathematical analysis of various cases.
Different ways to convert array to set in C++
In this article, we will discuss the three most common ways to convert an array into a set in C++.