Reels safe-zone boxes in Python: a pure function for any frame size

Meta's Reels percentages are relative, so one pure Python function gives the safe box for any frame size. It runs offline and feeds a caption anchor.

4 min readSume
All posts

Meta's Reels ad guide gives the safe area as fractions: 14% top, 35% bottom, 6% each side. A pure function turns any width and height into the box in pixels, with no network call. The code below runs as written. It returns 1080x1920 as 269, 672 and 65 px, and a caption anchor range for a text block of a given height.

The function

Percentages are from Meta's guide, read 2026-10-04. The anchor range is what you pass to design.placement.anchor_ratio in video captions, where the OpenAPI schema accepts 0.05 to 0.95.

def box(w, h, top=0.14, bottom=0.35, side=0.06):
    t, b, s = round(h * top), round(h * bottom), round(w * side)
    return {"left": s, "top": t, "right": w - s, "bottom": h - b}

def anchor(w, h, block_px):
    z = box(w, h)
    lo = (z["top"] + block_px / 2) / h
    hi = (z["bottom"] - block_px / 2) / h
    lo, hi = max(lo, 0.05), min(hi, 0.95)
    return round(lo, 2), round(hi, 2)

print(box(1080, 1920))
print(anchor(1080, 1920, 150))

Sizes compared

The same fractions applied to two frame sizes (my arithmetic on Meta's percentages).

Safe box at two sizes (Meta percentages read 2026-10-04, pixels computed)
FrameTopBottomSideBox
1080 x 192026967265950 x 979
1440 x 2560358896861268 x 1306

Sources

Related posts

More in Developers

All Developers posts

Written by Sume