.CLS file extension

To open .CLS files on Windows, if you just need to view or edit it: open the .cls file in a plain-text editor (for example, Windows Notepad) and treat it as source code, not a document.

To open a .cls file, use a plain-text editor (for viewing/editing) or a TeX/LaTeX editor and compile a .tex document that uses the class. On mobile, you can usually only view it as text; compiling LaTeX is typically a desktop workflow.

Last updated: April 29, 2026 · Reviewed by Julian Stricker

Open on your device

Choose your operating system for a dedicated step-by-step opening guide.

How to open .CLS files

Use these platform-specific instructions to open .CLS files safely.

Windows

  1. If you just need to view or edit it: open the .cls file in a plain-text editor (for example, Windows Notepad) and treat it as source code, not a document.
  2. If you need to use it for typesetting: install a TeX distribution (for example, TeX Live) and compile the associated .tex file that uses the class (\documentclass{...}); ensure the .cls is in the project folder or installed in the TeX tree.
Full Windows guide

Mac

  1. To view/edit: open the .cls file with a plain-text editor (such as TextEdit set to plain text) and avoid rich-text formatting.
  2. To typeset: install a TeX distribution and compile the .tex document that references the class; keep the .cls alongside the .tex file or install it into the TeX tree so the engine can find it.
Full Mac guide

Linux

  1. To view/edit: open the .cls file in a text editor and treat it as plain text.
  2. To use it in compilation: use a TeX distribution (such as TeX Live) and compile the related .tex document; ensure the .cls is in your working directory or correctly installed under the TEXMF tree so it is discoverable.
Full Linux guide

iOS

  1. Open the .cls file in the Files app and use a text-editor app to view it as plain text; for compiling LaTeX with that class, transfer the project to a desktop TeX setup.
Full iOS guide

Android

  1. Open the .cls file with a text editor to view it as plain text; for reliable LaTeX compilation with the class, move the project to a desktop TeX distribution.
Full Android guide

Security notes

  • .cls files are executable as TeX/LaTeX code in the sense that they are interpreted by the TeX engine during compilation; only compile documents and class files you trust, especially when they come from unknown sources.
  • Be cautious with templates or projects that include unusual build steps or scripts alongside .cls/.tex files; the class file itself is text, but a full LaTeX build workflow may invoke external tools depending on your setup.
  • If you only need to inspect a .cls file, viewing it in a plain-text editor is safer than compiling it.

Recommended antivirus software

Scan files before opening them. These antivirus tools help protect against malware and viruses.

We may earn a commission when you use affiliate links. This supports our free file extension guides.

Can't open this file?

These are the most common causes and fixes when .CLS files fail to open.

Common reasons

  • LaTeX error: “File '<class>.cls' not found”
  • The .cls opens as “garbled text” or in the wrong app
  • Compilation fails after editing the .cls

Fix steps

  1. Confirm the class name in \documentclass{...} matches the .cls filename (without the .cls extension).
  2. Place the .cls file in the same folder as your .tex file and compile again.
  3. If you need it system-wide, install it into the appropriate TeX tree location used by your distribution (TeX Live uses TEXMF trees) and refresh the file database if your setup requires it.

What is a .CLS file?

A .cls file is a LaTeX class file: a text-based file containing TeX/LaTeX macros that control the overall document layout (e.g., article, report, book, or custom publisher templates). LaTeX loads a class via commands like \documentclass{...}, and the TeX system finds installed .cls files in its TEXMF trees. In practice, .cls files are part of LaTeX installations or distributed with templates and are interpreted by TeX engines during compilation.

Background

LaTeX is a document preparation system built on TeX, widely used for technical and scientific writing. In LaTeX workflows, the document “class” is central: it defines high-level structure, default typography, and formatting conventions for the document, and those rules live in a .cls file.

The LaTeX Project’s documentation for class and package authors explains how class files are written and how they define document structure and formatting. Standard classes (and many custom ones) are distributed as .cls files, and many are available via CTAN.

On typical systems, .cls files are installed within a TeX distribution’s directory trees (TEXMF). For example, TeX Live documents that LaTeX class files live under TeX trees and are found automatically by the TeX system when you compile a .tex document that references them.

For most users, you do not “open” a .cls file to read a document; instead, you either (1) edit it as source code, or (2) place/install it so LaTeX can use it while compiling a .tex document into PDF or other output.

Common MIME types: text/x-tex

Further reading

Authoritative resources for more details on the .CLS format.

Common .CLS issues

LaTeX error: “File '<class>.cls' not found”

The TeX/LaTeX system cannot locate the class file referenced by \documentclass{...}. This commonly happens when the .cls is not installed in the TeX tree or not present in the project folder.

  1. Confirm the class name in \documentclass{...} matches the .cls filename (without the .cls extension).
  2. Place the .cls file in the same folder as your .tex file and compile again.
  3. If you need it system-wide, install it into the appropriate TeX tree location used by your distribution (TeX Live uses TEXMF trees) and refresh the file database if your setup requires it.

The .cls opens as “garbled text” or in the wrong app

.cls is plain text containing TeX macros; opening it in a word processor or a binary viewer can make it look incorrect or hard to read.

  1. Re-open the file using a plain-text editor, not a word processor.
  2. If the file is extremely hard to read, verify it is actually a LaTeX class file (it should contain TeX/LaTeX commands and comments) and that the download was not corrupted.

Compilation fails after editing the .cls

Small syntax mistakes in TeX macro code can break compilation or change document behavior unexpectedly.

  1. Undo recent changes and recompile to confirm the class edits caused the problem.
  2. Compare against the original class file provided with the template or distribution, and apply changes incrementally while recompiling.
  3. Consult LaTeX class authoring guidance to ensure you are using correct LaTeX conventions and commands.

FAQ

Is a .cls file a document I can read like a PDF or Word file?

No. A .cls file is LaTeX source code that defines formatting rules. The readable output is produced when you compile a .tex document that uses the class.

Where should I put a .cls file so LaTeX can find it?

The simplest approach is to put it in the same folder as your .tex file. For system-wide use, install it into your TeX distribution’s TEXMF tree in the appropriate LaTeX directory so the TeX system can locate it.

Can I convert a .cls file to PDF?

Not directly. You compile a .tex document that uses the .cls file; the compiler then generates PDF (or other formats) from the .tex document.

What is the correct MIME type for .cls?

There is no single universally official MIME type specifically for .cls. In practice, TeX/LaTeX-related files are often labeled with non-standard types such as text/x-tex, and different systems may map them differently.

Similar file extensions

Compare related formats in the same category to find the right tool faster.