LaTeX Margins and Page Size with the geometry Package
Quick answer
- All margins:
\usepackage[a4paper, margin=2.5cm]{geometry}in the preamble. - Per side:
\usepackage[left=3cm, right=2cm, top=2.5cm, bottom=2.5cm]{geometry}. - US Letter, 1 inch:
\usepackage[letterpaper, margin=1in]{geometry}. - Landscape: add
landscapeto the options. - One page only:
\newgeometry{margin=1.5cm}...\restoregeometry.
To set margins in LaTeX, load the geometry package with the paper size and margins you want, for example \usepackage[a4paper, margin=2.5cm]{geometry}. This guide covers per-side and two-sided margins, A4 versus US Letter, custom page sizes, landscape pages, changing margins mid-document with \newgeometry, header spacing and the \headheight warning, and the errors that come up along the way.
Default Page Layout
Before you change anything, it helps to understand what LaTeX does out of the box. The default page size depends on the document class and your TeX distribution:
- US Letter (8.5 × 11 in) – default for most US-based TeX distributions and classes such as
article,report, andbook. - A4 (210 × 297 mm) – common default when the distribution is configured for European or international use, and used by many journal templates.
LaTeX's built-in margin defaults are intentionally wide — about 1.875 inches (4.7 cm) on the left and right of a 10pt article on letter paper — because the text width is chosen for a line length of about 66 characters, not to fill the page. While this produces pleasant body text, most authors need tighter control for submission requirements, institutional guidelines, or personal preference.
Set Margins in LaTeX with the geometry Package
The geometry package is the standard way to set margins in LaTeX. One line in the preamble sets the paper size and all four margins, and geometry recalculates \textwidth, \textheight, \oddsidemargin and the other internal lengths for you, so you never edit them by hand.
The geometry package is the standard tool for setting page size and margins in LaTeX. It provides a clean, declarative interface that replaces the manual adjustment of internal length parameters such as \textwidth, \textheight,\oddsidemargin, and others.
Basic usage is straightforward:
\usepackage[a4paper, margin=2.5cm]{geometry}You can also pass options on a separate line for better readability:
\usepackage{geometry}
\geometry{
a4paper,
left=25mm,
right=25mm,
top=30mm,
bottom=30mm
}Both approaches are equivalent. Use whichever style you find easier to maintain.
Margins can be set individually or all at once. The geometry package accepts both metric and imperial units (mm, cm, in, pt).
Per-Side Margins
\usepackage{geometry}
\geometry{
a4paper,
left=30mm,
right=25mm,
top=25mm,
bottom=25mm
}Uniform Margins
Use the margin key to set all four margins to the same value:
\usepackage[a4paper, margin=1in]{geometry}Horizontal and Vertical Shortcuts
\usepackage{geometry}
\geometry{
a4paper,
hmargin=25mm, % sets left and right
vmargin=30mm % sets top and bottom
}Two-sided Documents (inner/outer)
For documents printed on both sides (books, theses), use inner andouter instead of left and right. The inner margin is the one closest to the binding:
\documentclass[twoside]{book}
\usepackage{geometry}
\geometry{
a4paper,
inner=30mm, % binding side
outer=20mm, % outside edge
top=25mm,
bottom=25mm
}a4paper vs letterpaper
Always name the paper size next to the margins. Without it, geometry uses the class default, which is US Letter for the standard classes in most distributions, so a document you meant for A4 comes out 6 mm wider and 18 mm shorter than expected. You can give the size to the class or to geometry; geometry picks up the class option:
% Either of these gives A4 with 2.5 cm margins
\documentclass[a4paper]{article}
\usepackage[margin=2.5cm]{geometry}
\documentclass{article}
\usepackage[a4paper, margin=2.5cm]{geometry}
% US Letter with 1-inch margins
\documentclass{article}
\usepackage[letterpaper, margin=1in]{geometry}With pdfLaTeX, XeLaTeX and LuaLaTeX, geometry also sets the PDF page size, so the PDF viewer shows the paper size you asked for.
Landscape
There are several ways to use landscape orientation in LaTeX, depending on whether you want the entire document or just selected pages in landscape.
Entire Document in Landscape
Pass the landscape option to geometry:
\usepackage[a4paper, landscape, margin=1in]{geometry}Individual Landscape Pages
Use the lscape package (or pdflscape for PDF output that rotates the view in PDF readers) to insert landscape pages within a portrait document:
\usepackage{pdflscape}
% ... portrait content ...
\begin{landscape}
% This content appears on a landscape page
\begin{table}[ht]
\centering
\caption{A wide table that needs landscape orientation}
\begin{tabular}{lcccccccc}
\toprule
Item & Jan & Feb & Mar & Apr & May & Jun & Jul & Aug \\
\midrule
Sales & 120 & 135 & 150 & 142 & 160 & 175 & 180 & 190 \\
\bottomrule
\end{tabular}
\end{table}
\end{landscape}
% ... portrait content continues ...Landscape with Adjusted Margins
If you need different margins on landscape pages, combine pdflscape with \newgeometry. Call \newgeometry before the landscape environment and \restoregeometry after it, not inside:
\documentclass{article}
\usepackage[a4paper, margin=1in]{geometry}
\usepackage{pdflscape}
\begin{document}
Portrait text.
\newgeometry{margin=15mm}
\begin{landscape}
Wide content here.
\end{landscape}
\restoregeometry
Portrait again, with the original margins.
\end{document}Change Margins Mid-Document with \newgeometry
Sometimes you need different margins for different sections of your document — for example, wider margins for an appendix with large figures, or narrower margins for a title page. The geometry package provides two commands for this:
\documentclass{article}
\usepackage{geometry}
\geometry{a4paper, margin=1in}
\begin{document}
\section{Normal Section}
This text uses the default 1-inch margins.
% Switch to new margins
\newgeometry{left=15mm, right=15mm, top=20mm, bottom=20mm}
\section{Wide Section}
This section has narrower margins for more content space.
Perfect for wide tables or figures.
% Restore original margins
\restoregeometry
\section{Back to Normal}
Margins are back to the original 1-inch setting.
\end{document}Important notes about \newgeometry:
- It always triggers a page break, so place it at natural section boundaries.
\restoregeometryreturns to whatever was set in the preamble\geometry{...}call.- You can call
\newgeometrymultiple times with different settings throughout the document.
Header Height and the fancyhdr Warning
When using packages like fancyhdr for custom headers and footers, you often need to adjust spacing to prevent overlaps. The geometry package provides dedicated options for this:
\usepackage{geometry}
\geometry{
a4paper,
margin=1in,
headheight=14pt, % height of the header area
headsep=10mm, % space between header and body text
footskip=12mm % space between body text and footer
}With an 11pt or 12pt document and a fancy page style, the log shows Package fancyhdr Warning: \headheight is too small (12.0pt): Make it at least 14.49998pt. The header is taller than the space reserved for it, so it pushes the body down by a different amount on different pages. Give geometry the number from the warning, rounded up:
\usepackage[a4paper, margin=2.5cm, headheight=15pt]{geometry}
% or, after geometry has been loaded
\geometry{headheight=15pt}Including Header and Footer in Margins
By default, geometry places headers and footers inside the margin area. You can change this behaviour with the includeheadfoot option, which counts the header and footer as part of the text body:
\usepackage{geometry}
\geometry{
a4paper,
margin=1in,
includeheadfoot,
headheight=14pt,
headsep=10mm,
footskip=12mm
}Setting Page Size
The geometry package supports every standard paper size as well as fully custom dimensions. Pass the paper size as a package option:
% Standard sizes
\usepackage[a4paper]{geometry}
\usepackage[letterpaper]{geometry}
\usepackage[a5paper]{geometry}
\usepackage[b5paper]{geometry}
\usepackage[legalpaper]{geometry}
\usepackage[executivepaper]{geometry}
% Custom size
\usepackage[paperwidth=6in, paperheight=9in]{geometry}Common Paper Sizes
| Option | Width | Height | Typical Use |
|---|---|---|---|
a4paper | 210 mm | 297 mm | International standard, journals |
letterpaper | 8.5 in | 11 in | US standard |
a5paper | 148 mm | 210 mm | Small booklets, pocket guides |
b5paper | 176 mm | 250 mm | Books, textbooks |
legalpaper | 8.5 in | 14 in | US legal documents |
executivepaper | 7.25 in | 10.5 in | Business correspondence |
Common Margin Presets
Here are ready-to-use configurations for the most frequent scenarios:
1-inch Margins All Around
The most commonly requested layout for US academic submissions:
\usepackage[letterpaper, margin=1in]{geometry}Narrow Margins
Useful for drafts, internal reports, or maximising content area:
\usepackage[a4paper, margin=15mm]{geometry}Wide Margins
Good for documents with margin notes or for improved readability:
\usepackage{geometry}
\geometry{
a4paper,
left=40mm,
right=40mm,
top=35mm,
bottom=35mm
}Thesis-style Layout
Many universities require a wider binding margin. Here is a typical thesis configuration:
\documentclass[12pt, twoside]{report}
\usepackage{geometry}
\geometry{
a4paper,
inner=35mm, % extra space for binding
outer=25mm,
top=25mm,
bottom=30mm,
headheight=14pt,
headsep=12mm
}Quick Reference
Here is a summary of the most useful geometry package options:
| Option | Description | Example |
|---|---|---|
margin | Set all four margins equally | margin=1in |
left / right | Individual horizontal margins | left=30mm |
top / bottom | Individual vertical margins | top=25mm |
inner / outer | Margins for two-sided documents | inner=35mm |
hmargin | Set left and right margins together | hmargin=25mm |
vmargin | Set top and bottom margins together | vmargin=30mm |
headheight | Height of the header area | headheight=14pt |
headsep | Space between header and body | headsep=10mm |
footskip | Space between body and footer | footskip=12mm |
landscape | Switch to landscape orientation | landscape |
includeheadfoot | Include header/footer in body area | includeheadfoot |
paperwidth / paperheight | Custom paper dimensions | paperwidth=6in |
textwidth / textheight | Set body text area directly | textwidth=16cm |
Common Paper Sizes
A complete reference of ISO and North American paper sizes you may encounter:
| Size | Width (mm) | Height (mm) | Width (in) | Height (in) |
|---|---|---|---|---|
| A3 | 297 | 420 | 11.69 | 16.54 |
| A4 | 210 | 297 | 8.27 | 11.69 |
| A5 | 148 | 210 | 5.83 | 8.27 |
| A6 | 105 | 148 | 4.13 | 5.83 |
| B5 | 176 | 250 | 6.93 | 9.84 |
| US Letter | 216 | 279 | 8.5 | 11 |
| US Legal | 216 | 356 | 8.5 | 14 |
| US Executive | 184 | 267 | 7.25 | 10.5 |
Common Errors
| Symptom | Cause | Fix |
|---|---|---|
| LaTeX Error: Option clash for package geometry | geometry is loaded twice with different options, often once by a template | Load it once; change settings later with \geometry{...} |
| \headheight is too small (12.0pt): Make it at least 14.49998pt | fancyhdr header taller than the reserved space | headheight=15pt in the geometry options |
| Margins look different from what you set | Paper size not given, so letter paper is used | Add a4paper or letterpaper |
Margins change after \usepackage{geometry} with no options | geometry applies its own default layout | Always pass margin or per-side values |
| Unexpected blank page or page break | \newgeometry and \restoregeometry always start a new page | Call them only at a page or chapter boundary |
| Margins ignored, or the slides break, in a Beamer presentation | Beamer sets its own page size and does not support geometry | Drop geometry and use \setbeamersize{text margin left=5mm, text margin right=5mm} |
Frequently Asked Questions
How do I change the margins in LaTeX?
Load the geometry package in the preamble with the paper size and the margin you want: \usepackage[a4paper, margin=2.5cm]{geometry}. For different margins on each side, use left, right, top and bottom, as in \usepackage[left=3cm, right=2cm, top=2.5cm, bottom=2.5cm]{geometry}.
What are the default margins in LaTeX?
Without geometry, a 10pt article on US Letter paper has about 1.875 inches (4.7 cm) of margin on the left and right. The standard classes size the text block for readable line length, not to fill the page, which is why the default margins look wide.
How do I set 1-inch margins in LaTeX?
Add \usepackage[letterpaper, margin=1in]{geometry} to the preamble. On A4 paper use \usepackage[a4paper, margin=1in]{geometry}; margin sets all four sides at once.
How do I change the margins for one page in LaTeX?
Put \newgeometry{margin=1.5cm} where the page should start and \restoregeometry where the original margins should come back. Both commands start a new page, so place them at a page break.
How do I fix "\headheight is too small"?
The warning comes from fancyhdr when the header is taller than the space reserved for it. Add the value it suggests, rounded up, to the geometry options, as in \usepackage[a4paper, margin=2.5cm, headheight=15pt]{geometry}, or write \setlength{\headheight}{15pt} in the preamble.
Next Steps
Now that you can control page layout, explore more LaTeX topics:
- LaTeX Page Numbering – Roman and arabic numbering, page styles, fancyhdr headers and footers
- Horizontal Lines in LaTeX – Rules in text, tables, headers and under section titles
- Learn LaTeX – Complete beginner tutorial
- Learn TikZ – Create diagrams and graphics
- Learn PGFPlots – Generate publication-quality plots
Free LaTeX Tools
- LaTeX Preview – Test your LaTeX code with live PDF preview
- Math to LaTeX – Convert handwritten equations to LaTeX
- Excel to LaTeX – Convert spreadsheets to LaTeX tables
- Citation Generator – Generate BibTeX citations from DOIs
- AI LaTeX Generator – Generate LaTeX from text descriptions
- LaTeX Symbols Reference – Browse math operators and Greek letters
Ready to start writing?
Try Octree – the AI-powered LaTeX editor that makes writing faster and easier.
Try Octree Free →