.TEX

TEX File

TeX / LaTeX Source Document
Ask a question
QUICK ANSWER

A TEX file is a plain-text LaTeX or TeX source document containing your writing and backslash commands that control typesetting. To open it, use any text editor; to get the finished PDF, compile it with TeXstudio + MiKTeX/TeX Live, or upload it to Overleaf in a browser. The file itself is harmless to read, but compiling one from an untrusted source carries a small security risk.

Developer: Donald Knuth (TeX); Leslie Lamport (LaTeX, built on TeX) Category: Text Files Open standard MIME: text/x-tex
OPENS ON Windows macOS Linux Web
Related: .DOC · .ODT · .DOCX · .GDOC

On this page

19k+ extensions indexed
Last reviewed Jul 6, 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 TEX file format?

.tex is the source file format for the LaTeX and TeX typesetting systems. Files with the .tex extension are plain-text documents processed by a TeX engine - they contain a mix of regular text and backslash commands that control layout, formatting, and structure. .tex files commonly include mathematical expressions, symbols, and scientific notation, written using TeX's powerful math typesetting syntax.

The main application of .tex files is the preparation of academic papers, scientific and engineering books, theses, and journal articles - any document where precise typesetting of complex mathematical or technical content matters. TeX was originally created by Donald Knuth in 1978, and LaTeX (a macro layer built on top of TeX, introduced by Leslie Lamport in 1984) is today the most widely used variant. A core advantage of the format is that the same .tex source compiles to identical output on any operating system, using engines such as pdflatex, xelatex, or lualatex to produce a PDF (or historically a DVI file). The document structure follows a standard pattern: a preamble beginning with \documentclass{...} declares the document class and loads packages via \usepackage{...}, followed by the body enclosed in \begin{document} and \end{document}.

Security & safety

RISK: MEDIUM

A .tex file is plain text and harmless to read, but it is also EXECUTABLE markup: TeX runs as a program during compilation and, if shell-escape (\write18) is enabled, can run external system commands. A malicious .tex from an untrusted source could in principle write or execute files when compiled. Modern distributions restrict shell-escape by default, which limits this. Treat .tex files from unknown sources like downloaded code - inspect them first and don't enable unrestricted shell-escape. Viewing the source in a text editor carries no risk.

Format details

in a nutshell
FULL NAMETeX / LaTeX Source Documentaka LaTeX source file, TeX document
DEVELOPERDonald Knuth (TeX); Leslie Lamport (LaTeX, built on TeX)since TeX 1978 (Knuth); LaTeX 1984 (Lamport)
CATEGORYText Files
MIME TYPEtext/x-tex
TYPEPlain-text TeX/LaTeX typesetting source (markup with backslash commands)
STANDARDOpen · royalty-free

Programs that open TEX files

Windows5 apps
TeXworks Open-source Lightweight LaTeX editor bundled with MiKTeX/TeX Live - open the .tex and click Typeset to get the PDF.
MiKTeX Open-source The TeX distribution that actually compiles the file; install it, then use TeXstudio/TeXworks or run 'pdflatex file.tex' from the command line.
TeXnicCenter Open-source Windows LaTeX IDE; open the .tex and build with the MiKTeX backend. (Older but still functional.)
TeXstudio Open-source Open the .tex, then press Build/Compile (pdflatex). Pairs with a MiKTeX or TeX Live backend that supplies the packages.
Notepad / VS Code Open-source Open as plain text to read or edit; VS Code with the LaTeX Workshop extension also compiles.
macOS3 apps
Texmaker Open-source Cross-platform LaTeX IDE; open the .tex and compile with the TeX Live backend.
Skim Open-source Note: Skim is a PDF VIEWER for the compiled output (with SyncTeX), not a .tex editor - use it alongside a LaTeX editor, not to edit source.
TeXShop (MacTeX) Open-source Install MacTeX (TeX Live for macOS); open the .tex in TeXShop and Typeset to PDF.
Linux3 apps
TeX Live Open-source Install via your distro or upstream, then 'pdflatex file.tex' or compile from any IDE; 'tlmgr install <pkg>' adds missing packages.
Texmaker / TeXstudio Open-source Open the .tex in the IDE and build with the TeX Live backend.
Emacs + AUCTeX / gVim Open-source Full LaTeX editing in Emacs (AUCTeX) or Vim/gVim; compile from the editor or shell.
Web1 app
Overleaf Freemium Upload or create the .tex in a browser project and compile to PDF online - no local TeX install needed. The most common modern workflow.

Technical details

deep spec
File naturePlain-text source document - human-readable and editable in any text editor; no binary encoding
Character encodingASCII or UTF-8; LaTeX has defaulted to native UTF-8 input since the October 2018 kernel release
MIME typetext/x-tex (primary); also recognized as application/x-tex, application/x-latex, and text/plain
File signatureNone - no magic bytes or binary header; LaTeX files conventionally open with \documentclass{...} and all commands are prefixed with a backslash
Document structurePreamble (\documentclass, \usepackage, custom settings) followed by the body between \begin{document} and \end{document}
Command syntaxEvery formatting instruction is a backslash command (e.g., \textbf{}, \section{}, \frac{}{}); arguments in braces, optional arguments in square brackets
Math typesettingFirst-class math mode: inline ($...$) and display (\[...\] or equation environment) for equations, fractions, integrals, matrices, and Greek letters
Compilation enginespdfTeX/pdfLaTeX (most common), XeTeX/XeLaTeX (Unicode + OpenType fonts), LuaTeX/LuaLaTeX (Lua scripting), original tex engine (DVI output)
Output formatCompiled to PDF (via pdflatex, xelatex, or lualatex) or DVI (via the latex engine); the .tex file itself is never the finished document
Side files generatedEach compilation run creates .aux (cross-references), .log (engine log), .toc (table of contents), .bbl (bibliography), and .out (hyperref bookmarks)
Package ecosystemExtended via .sty package files; CTAN hosts over 6,000 packages covering fonts, graphics, tables, chemistry, music notation, and more
Document classesDocument type set by \documentclass{...}: built-in classes include article, book, report, letter, and beamer (slides); custom classes use .cls files
Multi-file supportLarge documents split across multiple .tex files linked via \input{filename} (direct inline inclusion) or \include{filename} (chapter-level with separate .aux handling)
Bibliography integrationExternal .bib database files processed by BibTeX or Biber; citations inserted with \cite{key} and resolved automatically during compilation
Typical file size1 KB to a few hundred KB per source file; large projects split across many .tex files rather than stored as one large document
Cross-platform consistencyProduces byte-for-byte identical typeset output on Windows, macOS, and Linux from the same .tex source - a core design goal of TeX since 1978
ReleasedTeX 1978 (Knuth); LaTeX 1984 (Lamport)
Latest versionLaTeX2e (1994, ongoing biannual releases); LaTeX3/expl3 in active use. TeX engine frozen at 3.141592653
Open standardYes · royalty-free
Specificationwww.latex-project.org

TEX conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with TEX 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 TEX files.

Frequently asked questions

What is a .tex file?
A LaTeX/TeX source document - plain text with backslash commands that control typesetting, used for academic papers, theses and math-heavy writing. It's the source you compile into a PDF, not the finished document.
How do I open a .tex file?
Any text editor reads it (it's plain text), but to compile it use a LaTeX editor like TeXstudio, TeXworks or TeXShop with a TeX distribution (MiKTeX/TeX Live/MacTeX), or open it on Overleaf in a browser.
How do I convert a .tex file to PDF?
Compile it: open in TeXstudio/Overleaf and click Build, or run 'pdflatex file.tex' (twice, plus BibTeX/Biber if it has citations). The PDF is the intended output of a .tex file.
Can I open a .tex file without installing LaTeX?
To just read/edit, yes - any text editor works. To get the formatted PDF without a local install, use Overleaf (browser-based LaTeX). You can't see the typeset result without compiling somewhere.
What's the difference between .tex, .sty and .cls?
All are TeX source. A .tex is your document; a .sty is a package loaded with \usepackage to add features; a .cls is a document class loaded with \documentclass that defines the document type.
Why won't my .tex compile?
Common causes: a missing package (install the .sty via MiKTeX/tlmgr), a syntax error (unbalanced braces, a typo'd command), or missing \begin{document}/\end{document}. The .log file points to the failing line.
How do I convert a .tex to Word (.docx)?
Use Pandoc: 'pandoc file.tex -o file.docx'. It handles text and basic structure well; complex math and layout usually need manual cleanup afterward.

References

1The LaTeX Project - documentationwww.latex-project.org
2TeX Users Group (TUG)www.tug.org

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.BINCD/DVD Disc Image (BIN/CUE)
4.DATProgram Data File (generic)
5.PARTPartial Download File
6.EXEWindows Executable (Portable Executable)
7.NOMEDIAAndroid No-Media Marker File
8.RPMSGRestricted Permission Message
9.TMPTemporary File
10.TXTPlain Text File

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