.CLS

CLS File

LaTeX Document Class File
Ask a question
QUICK ANSWER

A .cls file is most often a LaTeX document class file - a plain-text macro definition that sets the overall layout of a LaTeX document (margins, fonts, section styles). Open it with any text editor or a LaTeX editor such as TeXstudio. The same extension is also used by Visual Basic class modules and Salesforce Apex class files.

Developer: LaTeX Project (originally Leslie Lamport, 1985; maintained by LaTeX3 Project team) Category: Text Files Open standard MIME: text/plain
OPENS ON Windows macOS Linux Web
Related: .DOC · .ODT · .DOCX · .GDOC

On this page

19k+ extensions indexed
Last reviewed Jul 7, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the CLS file format?

A .cls file is a LaTeX document class file - a plain-text macro definition that determines the overall structure, layout, and typography of a LaTeX document. When you open any .tex source that begins with \documentclass{article} or \documentclass{beamer}, LaTeX searches its TEXMF directory tree for a matching file named article.cls or beamer.cls and loads it before processing content.

The class file controls global document settings: page geometry, font choices, sectioning hierarchy, running headers and footers, floats, and list environments. Inside a .cls file, options are declared with \DeclareOption, package dependencies with \RequirePackage, and the class identity with \ProvidesClass{classname}[YYYY/MM/DD vX.Y description]. The conventional opening line \NeedsTeXFormat{LaTeX2e} guards against loading by an incompatible TeX engine.

Standard classes - article, book, report, letter - ship with every major TeX distribution, including TeX Live and MiKTeX. Publishers such as IEEE, ACM, Elsevier, Springer, and the AMS distribute custom .cls templates that authors must use for journal or conference submissions.

A .cls file differs from a style package (.sty): a class sets the whole document framework, while a style file supplements it. Class source code is often distributed as a .dtx literate file with a companion .ins installer that extracts the deployable .cls. Being plain text, .cls files integrate cleanly into version-control workflows.

Security & safety

RISK: LOW

Plain text macro file; poses no direct executable risk to the operating system. Malicious LaTeX code is theoretically possible via \write18 shell-escape commands, but exploitation requires the victim to compile a .tex document with shell-escape enabled - not a realistic attack vector for .cls files distributed as templates.

Format details

in a nutshell
FULL NAMELaTeX Document Class Fileaka LaTeX Class File, TeX Class Definition
DEVELOPERLaTeX Project (originally Leslie Lamport, 1985; maintained by LaTeX3 Project team)since 1985 (LaTeX 2.09); .cls extension standardized with LaTeX2e, June 1994
CATEGORYText Files
MIME TYPEtext/plain
TYPEPlain text LaTeX macro definitions and document class commands
STANDARDOpen · royalty-free
This extension is also used by…
  • Visual Basic / Visual C++ Class Module - Plain-text source code class definition generated by VB6/VBA/VC++ IDE; same extension, different content.
  • Apex (Salesforce) Class File - Object-oriented Apex language class file used in Salesforce platform development.
  • AutoCAD / ArcGIS Color Classification File - Classification scheme file used by ArcGIS and AutoCAD for color ramp and geocoding settings.

Programs that open CLS files

Windows5 apps
TeXworks Open-source File → Open, select the .cls file; displays as syntax-highlighted TeX source.
Texmaker Open-source File → Open - .cls files open as TeX source for editing.
Notepad Open-source Open the .cls file directly; add LaTeX syntax highlighting via user-defined language.
TeXstudio Open-source File → Open - full TeX syntax highlighting and autocompletion for .cls editing.
Visual Studio Code Open-source Open the file; install LaTeX Workshop extension (James Yu) for full TeX language support.
macOS3 apps
TeXworks Open-source File → Open, select the .cls file.
Texmaker Open-source File → Open - opens as TeX source.
TeXShop Open-source Open directly; included with MacTeX distribution.
Linux2 apps
TeXworks Open-source File → Open - standard in TeX Live distribution on all major distros.
Texmaker Open-source File → Open - available in most distribution package managers.
Web1 app
Overleaf Freemium Upload the .cls to your project folder; it becomes available to \documentclass.

Technical details

deep spec
MIME typetext/plain; also recognized as application/x-tex
Character encodingASCII or UTF-8; pure ASCII recommended for broadest TeX engine compatibility
Binary signatureNone - plain text file with no magic bytes; identified by extension and content pattern only
Class declaration command\ProvidesClass{name}[YYYY/MM/DD vX.Y description] embeds class name, date, and version string
Format compatibility guard\NeedsTeXFormat{LaTeX2e} as conventional first line prevents loading by incompatible TeX formats
Option mechanismOptions declared with \DeclareOption and executed via \ProcessOptions or \ProcessOptions*
Dependency loading\RequirePackage{pkgname}[min-date] pulls in .sty packages with optional minimum-date guards
Class inheritance\LoadClass{parentclass} allows a class to extend another, overriding only selected definitions
Typical file size2 KB - 200 KB; simple skeleton class to full journal publisher template
Loading mechanismInvoked by \documentclass[options]{classname} as the first command in any .tex document
File search pathLaTeX locates classname.cls through the TEXMF tree; kpsewhich classname.cls reveals the resolved path
Compatible TeX enginespdfLaTeX, XeLaTeX, LuaLaTeX, and classic LaTeX (DVI mode); engine-specific guards use \ifXeTeX, \ifLuaTeX
Standard built-in classesarticle, book, report, letter, and slides ship with every LaTeX2e distribution
Publisher ecosystemIEEE, ACM, Elsevier, Springer, and AMS distribute proprietary .cls templates for journal and conference submissions
Source distribution formatClass source is often packaged as a .dtx literate file extracted by a companion .ins installer
Released1985 (LaTeX 2.09); .cls extension standardized with LaTeX2e, June 1994
Latest versionLaTeX2e (current; periodic dated releases, e.g. 2023-06-01)
Open standardYes · royalty-free
Specificationwww.latex-project.org

CLS conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with CLS files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about CLS files.

Frequently asked questions

How do I use a .cls file in my LaTeX document?
Place the .cls file in the same folder as your .tex file (or install it in your TEXMF tree), then add \documentclass{classname} as the first line of your .tex file, omitting the .cls extension.
LaTeX says 'File cls not found' - what do I do?
The class file is missing from your project folder or TeX tree. Download the correct .cls from the journal or conference website and place it next to your main .tex file.
Can I open a .cls file without installing LaTeX?
Yes - it is plain text. Any text editor (Notepad, VS Code, Texmaker) will open it. You only need a LaTeX compiler to build documents that use it.
What is the difference between .cls and .sty files?
.cls is a document class file loaded with \documentclass{} and sets the fundamental document type. .sty is a package file loaded with \usepackage{} and adds features on top of any class.
Can I edit the journal's .cls file to change the formatting?
Technically yes, but most journals prohibit modifying their class file for submission. Apply custom adjustments in the preamble of your .tex file instead.
Why does my IDE associate .cls with Visual Basic instead of LaTeX?
The .cls extension is shared by both formats. Rename the association in your IDE settings or use a dedicated LaTeX editor (TeXstudio, TeXworks) which recognizes it correctly.

References

1LaTeX Project - Writing Your Own Class (clsguide.pdf)www.latex-project.org
2Overleaf - Understanding packages and class fileswww.overleaf.com

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.PARTPartial Download File
4.BINCD/DVD Disc Image (BIN/CUE)
5.RPMSGRestricted Permission Message
6.MDMarkdown Document
7.NOMEDIAAndroid No-Media Marker File
8.PRO6XProPresenter 6 Bundle File
9.EXEWindows Executable (Portable Executable)
10.PRDXSoftMaker Presentations Document

Related extensions

.DOCMicrosoft Word 97-2003 Document
.ODTOpenDocument Text
.DOCXMicrosoft Word Open XML Document
.GDOCGoogle Docs Shortcut (Link to a Google Docs document)
.LSTList File (generic plain-text list / listing)
.VNTvNote (mobile phone text note / memo)

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z