KDP margins and gutter: check your PDF before you upload it
KDP's inside margin grows with the page count, and a book of 151 pages needs more than one of 150. The table from KDP's help, and forty lines of Python that find the text too close to an edge.
KDP prints a paperback, trims it, and binds the inner edge into the spine. Text too close to an edge gets cut, and text too close to the spine disappears into the fold. So KDP sets minimum margins for every interior. The rule people trip on is the inside one, because it depends on how thick the book is.
The margins, from KDP's help#
We read KDP's page "Set Trim Size, Bleed, and Margins" on 26 October 2026. Top, bottom and outside margins must be at least 0.25 in (6.4 mm) for a book without bleed, and 0.375 in (9.6 mm) with bleed. The inside margin, also called the gutter, depends on the page count:
- 24 to 150 pages: 0.375 in (9.6 mm)
- 151 to 300 pages: 0.5 in (12.7 mm)
- 301 to 500 pages: 0.625 in (15.9 mm)
- 501 to 700 pages: 0.75 in (19.1 mm)
- 701 to 828 pages: 0.875 in (22.3 mm)
KDP adds that some programs have separate fields for the inside margin and the gutter, and that you should put the same value in both.
Two things follow. A book laid out at 0.375 in fails as soon as it grows past 150 pages, so adding a few puzzles or an answer section can break a file that passed before. And the inside margin is on a different side of odd and even pages. Page 1 of a book is a right-hand page, so the spine is on the left of odd pages and on the right of even ones. A layout with the same margins on every page has its gutter on the wrong side half the time.
The check#
check() reads the position of every word with poppler's pdftotext -bbox and reports each page and side where text is closer to the edge than KDP allows, with the closest distance found. It is written for books without bleed, which is how most text and puzzle interiors are made.
import re, subprocess
def inside_margin(pages):
"""KDP's minimum inside (gutter) margin in inches for a paperback of this many pages."""
for most, inches in ((150, 0.375), (300, 0.5), (500, 0.625), (700, 0.75), (828, 0.875)):
if pages <= most:
return inches
raise ValueError("KDP paperbacks have at most 828 pages")
def words(pdf):
"""(page, x0, y0, x1, y1) in points for every word, from poppler's pdftotext."""
xml = subprocess.run(["pdftotext", "-bbox", pdf, "-"], capture_output=True, text=True, check=True).stdout
out, page = [], 0
for line in xml.splitlines():
if "<page " in line:
page += 1
w, h = (float(v) for v in re.search(r'width="([\d.]+)" height="([\d.]+)"', line).groups())
out.append((page, w, h, []))
elif m := re.search(r'xMin="([\d.]+)" yMin="([\d.]+)" xMax="([\d.]+)" yMax="([\d.]+)"', line):
out[-1][3].append(tuple(float(v) for v in m.groups()))
return out
def check(pdf, outside=0.25):
"""(page, side, inches there, inches needed) wherever text is closer to an edge than KDP allows, for a book
without bleed. Page 1 is a right-hand page: the gutter is on the left of odd pages, the right of even ones."""
pages = words(pdf)
gutter, worst = inside_margin(len(pages)) * 72, {}
for n, width, height, boxes in pages:
left = gutter if n % 2 else outside * 72
right = outside * 72 if n % 2 else gutter
for x0, y0, x1, y1 in boxes:
for side, room, need in (("left", x0, left), ("right", width - x1, right),
("top", y0, outside * 72), ("bottom", height - y1, outside * 72)):
if room < need - 0.01: # one line per page and side: the closest word
worst[n, side] = min(room, worst.get((n, side), (room,))[0]), need
return [(n, side, round(room / 72, 3), need / 72) for (n, side), (room, need) in sorted(worst.items())]for problem in check("tight.pdf")[:4]:
print(problem)What it found on test books#
We drew 6 x 9 in books with known margins and ran the check on each:
- 200 pages, gutter 0.5 in, outside 0.3 in: no problems, in about 0.6 s.
- The same book with a 0.375 in gutter: all 200 pages reported, on the left of odd pages and the right of even ones.
- 0.375 in gutter at 150 pages: no problems. At 151 pages: all 151 pages reported. One page more is enough.
- Gutter 0.5 in, but always on the right (not mirrored): the 100 odd pages reported, where the spine is on the left.
- One page number set 0.15 in above the bottom edge on page 37: exactly that, page 37, bottom, 0.121 in where 0.25 in is needed. The reading is lower than 0.15 because the box of a character includes the part below its baseline.
What it does not see#
pdftotext reports text only. A puzzle grid drawn with lines, a picture or a rule under a heading can sit in the gutter and this check will not notice. Neither will it check the page size, the fonts or the cover. For a puzzle book that is a real gap: the grid is usually the widest thing on the page.
Our KDP paperback file checker does the wider check on a web page: our server checks the files and does not keep them. You give it the interior PDF, and the cover if you have it, and it measures them against KDP's published paperback specs: page size, page count, embedded fonts, margins and gutter, line weight, blank pages, image resolution, and for the cover its size, spine and barcode area. It runs 20 times a day free across our tools, with no login. It is our check, not an approval from Amazon.
If the margins come out wrong because the book is new, the KDP puzzle book maker lays out puzzle books with the gutter for their page count and checks each file before you can download it. And why KDP rejects puzzle books lists the other reasons a file comes back.
written
19 min readKDP coloring book size and bleed: check your interior PDF in Python
The trim sizes KDP lists, when a coloring book needs bleed, why the page count doubles and what 300 ppi means. Then a Python check that reads your interior PDF and says where it breaks KDP's published rules.
4 min readWord scramble generator in Python: when LEMON is also MELON
A shuffle can hand back the word itself or another real word, and often leaves a third of it in place. The bigger catch is in the word list: 40% of the short words in 43 of our puzzle-book themes have letters that spell another word.
6 min readNonogram generator in Python: half of random grids have two answers
Clues from a random grid do not make a fair nonogram: at 10 x 10 and half the squares filled, half of them had more than one answer. A line solver in about seventy lines tells the fair ones apart in a few milliseconds.