The event shipment is booked into four pallet positions at a US warehouse. Then the packaging supplier adds 10 millimeters to two carton dimensions to accommodate a protective insert. The merchandise operations lead still has 100 gifts to ship, but the revised uniform stack needs seven positions. Sending the original booking without checking the new carton would move the problem to the receiving dock.

This calculator provides a repeatable first decision: how many identical packed cartons fit on one approved usable pallet rectangle under a single grid orientation, height allowance, layer limit and mass allowance? It separates geometric fit from permission to ship, so a buyer can bring a documented scenario to packaging engineering and the receiving warehouse before confirming the appointment.
Establish the load you are actually planning
The model uses identical outer shipping cartons, each already packed with the merchandise, inserts and internal protection that will travel. Measure the outside of that completed carton. A product drawing, empty gift box or nominal catalog dimension can miss the change that matters at a floor boundary. Keep dimensions in integer millimeters and masses in integer grams throughout the calculation.
The pallet example is deliberately identifiable. The current official EPAL Euro Pallet product page lists the EPAL 1 with a nominal 1,200 by 800 mm deck, 144 mm height, approximate weight of 25 kg and a 1,500 kg safe working load. The page is undated and was checked on November 17, 2026. These are product specifications, not a shipment's carrier gross limit or an approval of its carton stack.
For operational inputs, use the actual selected pallet and the approved clear deck after lateral setbacks. Confirm tare with all fixed securing materials included. Obtain the shipment's cargo allowance and gross allowance separately. A catalog's approximate empty-pallet weight cannot establish the mass of a pallet plus the particular boards, wrap or other fixed securing materials in your plan.
The working example assumes those approvals have already produced the values below. It does not recommend eliminating setbacks, top protection or securing materials to reproduce the numbers. If an input is unknown, the next action is to obtain it from its owner. Filling an empty field with a convenient product-page figure would hide the unresolved decision rather than complete the plan.
| Input | Meaning and unit | Example value | Confirmation needed |
|---|---|---|---|
| P and Q | Usable clear deck sides, mm | 1,200 and 800 | Warehouse-approved rectangle after setbacks |
| H | Net total envelope for pallet plus cartons, mm | 1,200 | Top-cap allowance already removed |
| T | Actual pallet height, mm | 144 | Selected pallet measurement |
| a, b and c | Packed outer carton dimensions, mm | 400, 300 and 250 | Approved packed-carton specification |
| w | Mass of one complete packed carton, g | 10,000 | Confirmed packed mass |
| tare | Pallet plus fixed securing materials, g | 25,000 | Actual approved configuration |
| cargo | Maximum carton cargo mass, g | 1,500,000 | Applicable approved cargo allowance |
| gross | Maximum complete palletized mass, g | 500,000 | Carrier and receiver-compatible allowance |
| N | Cartons in this shipment | 100 | Released order quantity |
| K | Independently approved maximum carton layers | 4 | Valid for every eligible orientation |
| axes | Permitted orientation IDs | 0 and 1 | Upright default; other IDs need approval |

Download the US pallet-fit workbook (.xlsx)
Height requires particular care. Here H is the envelope remaining after any top-cap allowance has already been deducted. It still includes the pallet itself, so subtract T once to obtain vertical room for cartons. Do not deduct the top-cap allowance again. Likewise, P and Q are already reduced by any required lateral setbacks; the calculator does not apply another margin.
Use stable orientation IDs instead of an ambiguous rotation switch
An upright-only carton keeps c vertical. It may turn on the deck, giving orientations 0 and 1. Laying the carton on another face changes its vertical dimension and may change how its contents and packaging behave. That requires explicit permission; a larger arithmetic result is not permission to tilt it.
The six IDs below remain fixed even when two sides happen to have the same length. Eligibility is a separate decision. Keeping the IDs stable makes it possible to compare an input row, a physical layout and the selected result without guessing what a word such as “sideways” meant to another shift.
| Orientation ID | Along P | Along Q | Vertical | Default eligibility |
|---|---|---|---|---|
| 0 | a | b | c | Upright, permitted |
| 1 | b | a | c | Upright, permitted |
| 2 | a | c | b | Tilted, approval required |
| 3 | c | a | b | Tilted, approval required |
| 4 | b | c | a | Tilted, approval required |
| 5 | c | b | a | Tilted, approval required |
K is not calculated from empty space. It is an independently approved layer maximum that applies to every orientation allowed in that run. If upright cartons may have four layers but a tilted version has a different approved limit, run separate cases with their respective permissions and K values. Combining the most favorable layer limit with a different orientation would describe a load nobody approved.
Each candidate uses one regular rectangular grid, repeated without changing direction between layers. The method does not mix carton rotations within a layer, alternate patterns, interlock layers or search for an optimal packing arrangement. It can reject a case that a different engineered pattern might accommodate. That is a model boundary to discuss with engineering, not a reason to quietly change the arithmetic.
Calculate geometry and mass, then apply the smaller capacity
For a permitted orientation with horizontal sides x and y and vertical side z, the number of cells per layer is floor(P divided by x) multiplied by floor(Q divided by y). Floor means keep only the whole cartons that fit along each side. The unused strips of deck remain unused; this model does not fill them with rotated cartons.
The height-derived layer count is floor((H minus T) divided by z). The allowable layer count is the smaller of that result and K. Multiply cells by allowable layers to obtain geometric capacity. A layer limit can therefore bind even when more vertical space remains, and additional height cannot override K.
Available carton mass is the smaller of cargo and gross minus tare. Divide that mass by w and round down to whole cartons. The candidate capacity is the smaller of geometric capacity and mass-derived carton capacity. The gross input includes the pallet and fixed securing materials; the cargo input covers the packed cartons. Swapping these concepts can produce a plausible-looking but incorrect answer.
Choose the highest candidate capacity. If capacities tie, choose the lowest orientation ID, regardless of the order in which permissions were supplied. For a positive order, divide N by capacity and round up to obtain pallet count. The final pallet contains the remainder after all preceding pallets are filled; an exact multiple leaves a full final pallet rather than zero cartons.
A mass limit can stop loading partway through the final geometric layer. The arithmetic permits that partial layer, but it does not design its placement or restraint. Record both cells per layer and allowable layers with the capacity, so the warehouse can see whether the selected count fills complete layers or creates a partial one that needs a physical decision.
Worked decision: a 10 mm packaging change halves upright capacity
Use the example inputs: P 1,200 mm, Q 800 mm, H 1,200 mm, T 144 mm, carton 400 by 300 by 250 mm, packed mass 10,000 g, tare 25,000 g, cargo allowance 1,500,000 g, gross allowance 500,000 g, N 100 cartons and K four layers. Only upright IDs 0 and 1 are approved.
The available carton height is 1,200 minus 144 = 1,056 mm. Both upright candidates can fit floor(1,056 divided by 250) = four layers, consistent with K. Orientation 0 gives floor(1,200 divided by 400) times floor(800 divided by 300) = 3 times 2 = six cells per layer, or 24 cartons geometrically.
Orientation 1 gives floor(1,200 divided by 300) times floor(800 divided by 400) = 4 times 2 = eight cells per layer. Four layers give 32 cartons. The mass allowance is min(1,500,000, 500,000 minus 25,000) = 475,000 g, enough for floor(475,000 divided by 10,000) = 47 cartons. Geometry therefore binds, and orientation 1 wins at 32 cartons.
One hundred cartons require ceiling(100 divided by 32) = four pallets. Three full pallets hold 96 cartons, leaving four for the final pallet. A full 32-carton pallet has an assumed gross mass of 32 times 10,000 plus 25,000 = 345,000 g. Its carton stack is 1,000 mm high; adding the 144 mm pallet gives 1,144 mm within H.
Now retain the same allowances and approvals but change a and b to 410 and 310 mm. Orientation 0 has floor(1,200 divided by 410) times floor(800 divided by 310) = 2 times 2 = four cells. Orientation 1 has floor(1,200 divided by 310) times floor(800 divided by 410) = 3 times 1 = three cells. At four layers their capacities are 16 and 12, so orientation 0 wins with 16.
The new booking quantity is ceiling(100 divided by 16) = seven pallets. Six full pallets hold 96 cartons and the seventh holds four. The same final-pallet count conceals a very different appointment requirement. The operations lead should hold the four-position booking until packaging engineering decides whether the smaller design provides the required protection, or the receiver accepts a revised shipment plan.
Acceptance is evidence-based: approved packed dimensions, the permitted orientation, a physical layout without overhang, accepted carton protection and a receiver-compatible position count. If the smaller carton fails its protection requirements, the calculation does not justify shrinking it anyway. Retain the larger package and resolve the seven-position requirement before release. No damage outcome or freight saving follows from the geometric comparison alone.
Worked decision: gross mass makes both upright patterns tie
Return to the 400 by 300 by 250 mm carton, but lower the approved gross limit to 200,000 g. Keep tare at 25,000 g and carton mass at 10,000 g. Available carton mass is min(1,500,000, 200,000 minus 25,000) = 175,000 g, giving floor(175,000 divided by 10,000) = 17 cartons.
Both upright candidates now cap at 17 despite their geometric capacities of 24 and 32. The deterministic tie rule selects ID 0. One hundred cartons require ceiling(100 divided by 17) = six pallets. Five full pallets hold 85 cartons, leaving 15 on the last pallet. A full 17-carton load has gross mass 195,000 g, while 18 cartons would reach 205,000 g and exceed the assumed limit.
The selected pattern has six cells per layer. Seventeen cartons represent two complete six-carton layers plus five cartons in a third layer. The last pallet's 15 cartons represent two complete layers plus three. These decompositions explain the partial layers, but they do not approve where the remaining cartons sit or how the load is restrained.
The warehouse lead must plan six positions or obtain a documented different allowance and rerun the case. Raising H cannot fix this mass bottleneck. Nor can changing to the eight-cell upright pattern increase the 17-carton capacity under the same gross limit. An orientation preference may be reviewed separately, but the calculator's tie result must remain ID 0 for reproducibility.
If securing materials change, revise actual tare before accepting the result. If carton mass changes, revise w. Acceptance includes measured complete-load gross mass, an approved partial-layer arrangement and restraint, and receiver acknowledgement of the resulting quantity and pattern. If any of those remain unresolved, keep the load on hold rather than treating a positive capacity as dispatch authorization.
Read the boundary results before reusing a scenario
A floor boundary can turn one millimeter into a whole lost layer. At H 1,144 mm, subtracting T leaves exactly 1,000 mm: four 250 mm layers. At H 1,143 mm, only 999 mm remains, so the upright stack drops to three layers. Orientation 1 then holds 24 cartons, and 100 cartons require five pallets with four cartons on the last one.
A gram boundary behaves the same way. With gross 345,000 g and tare 25,000 g, the available 320,000 g supports 32 cartons. Lower gross by one gram and the allowance becomes 319,999 g, supporting only 31. The result becomes four pallets with seven cartons on the final pallet. Do not round a limiting value up to recover a preferred booking.
The input validator rejects strings, booleans, decimals, nonpositive dimensions or carton mass, and negative order quantities. Tare may be zero as an integer input, but it must still represent an approved real assumption. Empty, duplicated or invalid orientation permissions produce an axes error. Height no greater than pallet height, or gross no greater than tare, produces a limit error.
Validation occurs before the empty-order shortcut. A zero-carton order does not excuse an invalid dimension or permission list. A valid empty order returns zero pallets without selecting an orientation. For a positive order, a fit error means no permitted candidate accommodates even one carton under all the current limits. Resolve the underlying assumption or approval rather than suppressing the error.
The following executable prototype preserves those rules. The boundary table uses the stated base input with the listed changes; its expected results define reproducible behavior, not a report of physical load testing. Error names are machine references: input means invalid numeric data, axes means invalid permissions, limit means no residual envelope or gross allowance, and fit means no positive permitted capacity.
"""S05 v1: integer millimetres/grams; uniform layers, zero overhang."""
def plan(P,Q,H,T,a,b,c,w,tare,cargo,gross,N,K,axes=(0,1)):
vals=(P,Q,H,T,a,b,c,w,tare,cargo,gross,N,K)
if any(type(v) is not int for v in vals) or min(P,Q,H,T,a,b,c,w,cargo,gross,K)<=0 or min(tare,N)<0:
return {'error':'E_INPUT'}
if type(axes) not in (tuple,list) or not axes or any(type(i) is not int or i not in range(6) for i in axes) or len(set(axes))!=len(axes):
return {'error':'E_AXES'}
if H<=T or gross<=tare: return {'error':'E_LIMIT'}
if N==0: return {'pallets':0,'last_cartons':0,'orientation':None,'capacity':0}
shapes=((a,b,c),(b,a,c),(a,c,b),(c,a,b),(b,c,a),(c,b,a))
rows=[]
for i in sorted(axes):
x,y,z=shapes[i]
cells=(P//x)*(Q//y)
layers=min((H-T)//z,K)
cap=min(cells*layers,min(cargo,gross-tare)//w)
if cap>0:
rows.append({'orientation':i,'capacity':cap,'cells':cells,'layers':layers})
if not rows: return {'error':'E_FIT'}
best=max(rows,key=lambda r:(r['capacity'],-r['orientation']))
cap=best['capacity']
return {**best,'pallets':(N+cap-1)//cap,'last_cartons':(N-1)%cap+1}
if __name__ == "__main__":
for bad_axes in (True, 1, 1.5, {0: None}):
assert plan(1200,1000,1500,150,300,200,250,10000,25000,1000000,1025000,100,5,bad_axes) == {'error':'E_AXES'}
| Test ID | Changed input | Exact output |
|---|---|---|
| base | {} | {"orientation": 1, "capacity": 32, "cells": 8, "layers": 4, "pallets": 4, "last_cartons": 4} |
| larger_carton | {"a": 410, "b": 310} | {"orientation": 0, "capacity": 16, "cells": 4, "layers": 4, "pallets": 7, "last_cartons": 4} |
| gross_binding | {"gross": 200000} | {"orientation": 0, "capacity": 17, "cells": 6, "layers": 4, "pallets": 6, "last_cartons": 15} |
| height_exact | {"H": 1144} | {"orientation": 1, "capacity": 32, "cells": 8, "layers": 4, "pallets": 4, "last_cartons": 4} |
| height_minus_one | {"H": 1143} | {"orientation": 1, "capacity": 24, "cells": 8, "layers": 3, "pallets": 5, "last_cartons": 4} |
| weight_exact | {"gross": 345000} | {"orientation": 1, "capacity": 32, "cells": 8, "layers": 4, "pallets": 4, "last_cartons": 4} |
| weight_minus_one | {"gross": 344999} | {"orientation": 1, "capacity": 31, "cells": 8, "layers": 4, "pallets": 4, "last_cartons": 7} |
| one_carton | {"N": 1} | {"orientation": 1, "capacity": 32, "cells": 8, "layers": 4, "pallets": 1, "last_cartons": 1} |
| zero_order | {"N": 0} | {"pallets": 0, "last_cartons": 0, "orientation": null, "capacity": 0} |
| forbidden_tilt | {"axes": [0]} | {"orientation": 0, "capacity": 24, "cells": 6, "layers": 4, "pallets": 5, "last_cartons": 4} |
| all_axes | {"axes": [0, 1, 2, 3, 4, 5]} | {"orientation": 1, "capacity": 32, "cells": 8, "layers": 4, "pallets": 4, "last_cartons": 4} |
| too_wide | {"a": 1201, "b": 801} | {"error": "E_FIT"} |
| no_payload | {"gross": 25000} | {"error": "E_LIMIT"} |
| bad_boolean | {"N": true} | {"error": "E_INPUT"} |
| duplicate_axes | {"axes": [0, 0]} | {"error": "E_AXES"} |
| noninteger | {"a": 400.5} | {"error": "E_INPUT"} |
| no_height | {"H": 144} | {"error": "E_LIMIT"} |
| negative_dimension | {"a": -1} | {"error": "E_INPUT"} |
| negative_order | {"N": -1} | {"error": "E_INPUT"} |
| zero_dimension | {"a": 0} | {"error": "E_INPUT"} |
| zero_mass | {"w": 0} | {"error": "E_INPUT"} |
| empty_axes | {"axes": []} | {"error": "E_AXES"} |
| bad_axis | {"axes": [6]} | {"error": "E_AXES"} |
| tilt_required_blocked | {"a": 1000, "b": 900, "c": 250} | {"error": "E_FIT"} |
| tilt_required_allowed | {"a": 1000, "b": 900, "c": 250, "axes": [2, 3, 4, 5]} | {"orientation": 2, "capacity": 3, "cells": 3, "layers": 1, "pallets": 34, "last_cartons": 1} |
BASE: {"P": 1200, "Q": 800, "H": 1200, "T": 144, "a": 400, "b": 300, "c": 250, "w": 10000, "tare": 25000, "cargo": 1500000, "gross": 500000, "N": 100, "K": 4}
Turn the result into a warehouse handoff
Start by naming the scenario and its owner. Record the carton specification version, selected pallet, usable deck approval, height allowance, actual tare configuration, cargo and gross limits, order quantity, approved layers and orientation permissions. A reusable result needs those inputs attached; “32 per pallet” by itself is too easy to reuse after the carton has changed.
Next, review all six orientation rows while distinguishing permitted candidates from reference-only possibilities. For the base carton, the geometric capacities across IDs 0 through 5 are 24, 32, 27, 24, 24 and 16. Those values help explain the model, but only IDs 0 and 1 participate in the upright-only selection. Seeing a permitted flag beside each row prevents an attractive tilted result from slipping into the load plan.
Then preserve the selected candidate's cells, allowable layers, final capacity, total pallets and final-pallet carton count. Add the full-load and final-load mass calculations, and describe any partial layers for engineering review. The person preparing the booking should be able to explain why a limit binds without recreating the calculation from memory.
Before dispatch, compare the actual layout with the approved plan. Confirm no overhang, measured total height, complete gross mass, carton compression suitability, stack stability, restraint and receiving-party acceptance. The plan-view grid needs actual coordinates and dimensions; a perspective illustration cannot establish clearances. The side view should distinguish pallet height from the remaining carton envelope rather than presenting one undifferentiated stack height.
Keep decisions assigned to their proper owners. Packaging engineering confirms the carton and applicable layer assumptions. Warehouse personnel confirm the actual pallet configuration and physical load. The receiving party confirms its appointment and acceptance requirements. The buyer coordinates the approved scenario and booking. This is a suggested handoff structure; it does not replace the organizations' actual responsibilities or agreements.
Rerun whenever packed dimensions, packed mass, pallet variant, securing materials, allowable envelope, orientation permission, K or order quantity changes. An unchanged product name is not enough to establish an unchanged shipping carton. Keep the prior scenario for comparison, but make the revised input set the one attached to the release decision. If a damaged pallet or uncertain measurement invalidates an input, stop and resolve it rather than editing the result directly.
The operations lead from the opening can now give the receiving warehouse a concrete choice. The approved smaller packed carton supports a four-pallet arithmetic plan; the larger revision requires seven under the same upright assumptions. The lead confirms the actual packaging decision and receiver capacity before changing the booking. The calculator has located the consequential difference without pretending to settle protection, restraint or dispatch approval.
Bring Giftpack the approved carton specification
Giftpack's custom merchandise and production service describes product and packaging development, sampling and production coordination around approved specifications. That makes a packed-carton requirement useful in the merchandise brief: the chosen gift, protection needs, outer dimensions, artwork, expected quantity and delivery requirements can be considered together. The service description does not establish that Giftpack certifies this calculator or authorizes a physical pallet load.
Bring the approved assumptions into that discussion, including which dimensions are provisional and who accepts the final packed sample. If a protective insert changes the carton, request the revised outer dimensions and packed mass before treating the earlier pallet result as current. Confirm the actual scope, timing and commercial details for the project rather than assuming a planning example is a quotation.
The Giftpack website also outlines broader merchandise and delivery services. For this shipment, the next step remains specific: agree on the merchandise and packaging specification, obtain the required physical and receiving approvals, and attach the current pallet scenario to the handoff. A repeatable calculation supports that conversation while leaving load acceptance with the people responsible for the actual shipment.

