w:pgMar (Page Margins)

Defines top, bottom, left, right, header, footer, and gutter margins for the page.

Parent elements

Description

w:pgMar defines the page margins for a section. It is defined in ECMA-376 Part 1 §17.6.11.

All values are in twips (1/20 of a point; 1440 twips = 1 inch). The w:header and w:footer values control the distance from the page edge to the header/footer band, not to the main text area.

Attributes

Attribute Type Possible Values Description
w:top ST_SignedTwipsMeasure Integer (twips, may be negative). Top margin (from page edge to main text area).
w:right ST_TwipsMeasure Positive integer (twips). Right margin.
w:bottom ST_SignedTwipsMeasure Integer (twips, may be negative). Bottom margin.
w:left ST_TwipsMeasure Positive integer (twips). Left margin.
w:header ST_TwipsMeasure Positive integer (twips). Distance from top edge to top of header.
w:footer ST_TwipsMeasure Positive integer (twips). Distance from bottom edge to bottom of footer.
w:gutter ST_TwipsMeasure Positive integer (twips). Gutter margin added to binding side.

Examples

<!-- Standard 1-inch margins all around -->
<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440"
         w:header="708" w:footer="708" w:gutter="0"/>
<!-- Narrow margins with binding gutter -->
<w:pgMar w:top="720" w:right="720" w:bottom="720" w:left="720"
         w:header="360" w:footer="360" w:gutter="360"/>

Measurement Conversions

Margin Twips Inches mm
0.25” 360 0.25 6.35
0.5” 720 0.5 12.7
0.75” 1080 0.75 19.05
1” 1440 1 25.4
1.5” 2160 1.5 38.1
2” 2880 2 50.8

Margin Profiles

Standard Academic (1” all sides)

<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440"
         w:header="720" w:footer="720" w:gutter="0"/>

Narrow (0.75” all sides)

<w:pgMar w:top="1080" w:right="1080" w:bottom="1080" w:left="1080"
         w:header="540" w:footer="540" w:gutter="0"/>

Bound Document (1” left, 0.75” others, 0.5” gutter)

<w:pgMar w:top="1080" w:right="1080" w:bottom="1080" w:left="1440"
         w:header="720" w:footer="720" w:gutter="720"/>

Book Style (Mirror Margins + Gutter)

<w:pgMar w:top="1440" w:right="1080" w:bottom="1440" w:left="1440"
         w:header="720" w:footer="720" w:gutter="360"/>
<!-- With w:mirrorMargins enabled, odd/even pages swap left/right -->
<w:pgMar w:top="360" w:right="1440" w:bottom="1440" w:left="1440"
         w:header="1440" w:footer="720" w:gutter="0"/>

Twips Conversion Table

Inches mm Twips
0.25” 6.35 360
0.5” 12.7 720
0.75” 19.05 1080
1.0” 25.4 1440
1.5” 38.1 2160
2.0” 50.8 2880

Header/Footer Spacing Logic

The w:header and w:footer attributes define distance from page edge to the header/footer band:

Page Edge
    ↓
  [w:header] = 0.5"
    ↓
┌───────────────────┐
│  Header Content   │  ← Renders within header band
└───────────────────┘
    ↓ (Header ends)
┌───────────────────┐
│   Main Text Area  │  ← Body text starts here
│  (bounded by      │     Left: w:left, Right: w:right,
│  top/bottom)      │     Top: below header, Bottom: above footer
└───────────────────┘
    ↓ (Body ends)
┌───────────────────┐
│  Footer Content   │  ← Renders within footer band
└───────────────────┘
    ↓
  [w:footer] = 0.5"
    ↓
Page Edge

Gutter Margins

Purpose: Extra margin on binding edge (left for LTR, right for RTL) for book/document binding.

Without Gutter:

  • Left margin = 1.5”
  • Text column width = page width - 1.5” - 1.5” (right)

With Gutter (0.5”):

  • Left margin = 1.5” (base) + 0.5” (gutter) = 2.0”
  • Text column width = page width - 2.0” - 1.5” (right)
  • Gutter space remains blank (for binding hole, punch)

Notes

  • Twips Conversion: 1440 twips = 1 inch. Divide twips by 1440 for inches; by 56.7 for millimeters.
  • Header/Footer vs Margins: w:header/w:footer are separate from w:top/w:bottom; both constrain text area.
  • Gutter Function: Gutter is added to the left margin (LTR) or right margin (RTL) for binding space; shifts entire text column.
  • Mirror Margins: When w:mirrorMargins is enabled, left/right margins alternate on odd/even pages; gutter follows binding edge.
  • Negative Margins: w:top and w:bottom can be negative (overflow into page edge), though uncommon; other margins typically positive.
  • Default Values: Omitting w:pgMar uses Word’s defaults (typically 1 inch all sides with 0.5” header/footer).
  • Section-Specific: Each w:sectPr can define different margins; sections change margin values mid-document.
  • Effective Text Area: Main text = page width - left - right - gutter; height = page height - top - bottom; header/footer are separate bands.
  • RTL Compatibility: Margin semantics mirror in right-to-left documents; left becomes right semantically, though XML remains unchanged.
  • Printing: Printers have physical margins (non-printable edge); keep document margins > printer margin for visibility.
  • Rendering Consistency: Margin values render consistently across all Office versions and export formats.
  • Accessibility: Large margins reduce effective text area; balance readability vs. printability.