lecture.studio

Marp slide size and aspect ratio: 16:9, 4:3, 4K, custom

Marp slides are 16:9 at 1280×720 pixels by default; size: 4:3 in the front matter switches the deck to 960×720. Other sizes come from the theme: a /* @size 4K 3840px 2160px */ comment in the theme CSS defines a name the size directive can use. The size is per deck (a global directive), the PDF page follows it exactly, and every px in the theme is relative to that canvas.

This guide covers the directive, how sizes are defined, the effect on fonts and PDFs, and the ratio to pick for the projector you will actually meet.

The directive

---
marp: true
size: 4:3
---

size is a Marp Core global directive: one value for the whole deck, set in the front matter. There is no per-slide size.

Name Pixels Where
16:9 1280 × 720 built-in themes, default
4:3 960 × 720 built-in themes

Custom sizes in a theme

The built-in names are declared in the theme with a metadata comment, and a custom theme can declare more:

/* @theme cs101 */
/* @size 16:9 1280px 720px */
/* @size 4:3 960px 720px */
/* @size 4K 3840px 2160px */
/* @size a4 210mm 297mm */
@import 'default';

Then size: 4K or size: a4 in a deck that uses the theme. Tested with marp-cli 4.5: the slides' SVG canvas becomes 3840 × 2160. A theme that imports default inherits its two sizes, so the comments only need to add new ones.

Sizes in mm make print layouts (an A4 handout of one slide per page, a poster) possible; the PDF page takes the size.

What changes with the size

The projector scales the slide to fit, so a 1280 × 720 deck on a 4K projector is upscaled but not blurry for text and vector content; only raster images show their pixels. 4K sizes matter for image-heavy decks and for exporting stills.

Which ratio for a lecture room

16:9 is the safe choice: new projectors, screens and video conferencing are all widescreen, and a 16:9 deck on an old 4:3 projector is letterboxed but complete. A 4:3 deck on a widescreen projector wastes a third of the width with bars. The exceptions: a department whose rooms are still 4:3 (a 4:3 deck fills them), and a handout printed on A4, which is a separate export rather than a reason to change the deck.

If you must serve both, keep the deck 16:9 and check the Check slides scan after switching to 4:3 for a one-off; anything that overflows is a slide with too much on it anyway.

FAQ

How do I change the slide size in Marp?

size: 4:3 or size: 16:9 in the front matter. Other names come from the theme's @size declarations.

What is the default Marp slide size?

16:9 at 1280 × 720 pixels; 4:3 is 960 × 720.

Can I set a custom size like 4K or A4?

Yes, in the theme: /* @size 4K 3840px 2160px */, then size: 4K in the deck. Millimetres work for print sizes.

Can different slides have different sizes?

No. size is a global directive, one per deck.