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 landscape to 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.
  • \restoregeometry returns to whatever was set in the preamble\geometry{...} call.
  • You can call \newgeometry multiple 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

OptionWidthHeightTypical Use
a4paper210 mm297 mmInternational standard, journals
letterpaper8.5 in11 inUS standard
a5paper148 mm210 mmSmall booklets, pocket guides
b5paper176 mm250 mmBooks, textbooks
legalpaper8.5 in14 inUS legal documents
executivepaper7.25 in10.5 inBusiness 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:

OptionDescriptionExample
marginSet all four margins equallymargin=1in
left / rightIndividual horizontal marginsleft=30mm
top / bottomIndividual vertical marginstop=25mm
inner / outerMargins for two-sided documentsinner=35mm
hmarginSet left and right margins togetherhmargin=25mm
vmarginSet top and bottom margins togethervmargin=30mm
headheightHeight of the header areaheadheight=14pt
headsepSpace between header and bodyheadsep=10mm
footskipSpace between body and footerfootskip=12mm
landscapeSwitch to landscape orientationlandscape
includeheadfootInclude header/footer in body areaincludeheadfoot
paperwidth / paperheightCustom paper dimensionspaperwidth=6in
textwidth / textheightSet body text area directlytextwidth=16cm

Common Paper Sizes

A complete reference of ISO and North American paper sizes you may encounter:

SizeWidth (mm)Height (mm)Width (in)Height (in)
A329742011.6916.54
A42102978.2711.69
A51482105.838.27
A61051484.135.83
B51762506.939.84
US Letter2162798.511
US Legal2163568.514
US Executive1842677.2510.5

Common Errors

SymptomCauseFix
LaTeX Error: Option clash for package geometrygeometry is loaded twice with different options, often once by a templateLoad it once; change settings later with \geometry{...}
\headheight is too small (12.0pt): Make it at least 14.49998ptfancyhdr header taller than the reserved spaceheadheight=15pt in the geometry options
Margins look different from what you setPaper size not given, so letter paper is usedAdd a4paper or letterpaper
Margins change after \usepackage{geometry} with no optionsgeometry applies its own default layoutAlways pass margin or per-side values
Unexpected blank page or page break\newgeometry and \restoregeometry always start a new pageCall them only at a page or chapter boundary
Margins ignored, or the slides break, in a Beamer presentationBeamer sets its own page size and does not support geometryDrop 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:

Free LaTeX Tools

Ready to start writing?

Try Octree – the AI-powered LaTeX editor that makes writing faster and easier.

Try Octree Free →