# logistics.container-fit How many identical cartons fit in a shipping container or a road trailer: the best of the carton's orientations, in a simple block stow (every carton the same way round, in rows, columns and layers), then capped by the payload. ## Orientations A carton can lie six ways. With `keepUpright` ("this way up" cartons) only the two that keep `heightMm` vertical are tried; otherwise all six. Each orientation's count is `floor(L / a) x floor(W / b) x floor(H / c)`, and the largest wins, ties going to the first in this order: as given, turned on the floor, then the four tipped ones (length-height-width, height-length-width, width-height-length, height-width-length). Turning a carton on the floor often matters more than people expect: 580 x 380 x 300 mm cartons in a 40ft high cube give 1,080 as given and 1,116 turned (31 rows of 380 mm beat 20 rows of 580 mm). Dividing the volumes instead (`container volume / carton volume`) overstates the answer every time, since the gaps at the walls and roof are real. It is a block stow, not an optimiser: filling the leftover strip along a wall with cartons turned the other way can add a few more, and load-planning software does that. The answer here is a safe, reproducible lower bound. ## Doors A carton has to get in. Containers are loaded through the end doors, which are smaller than the inside (a 20ft box is 2,393 mm high inside but 2,292 mm at the door), so an orientation whose width or height does not pass the door is not used. The trailer is a curtainsider, loaded from the side, so it has no door limit. No usable orientation at all is an error. ## Weight `weightLimit = floor(maxPayloadKg x 1000 / cartonGrams)`, using the container's rated payload or the caller's lower `maxPayloadKg` (road weight limits on the vehicle carrying the box are often the real constraint: ask the haulier). A figure above the container's rating is an error. `cartons` is the smaller limit, and `limitedBy` says which one it was. The payload is assumed spread evenly; concentrated loads have their own limits. ## Container data Inside and door dimensions are the carrier's nominal figures, not the ISO minimums: an ISO 668 / ISO 1496-1 container is only guaranteed 5,898 x 2,350 x 2,350 mm inside (20ft), so a plan that needs the last few millimetres may not fit every box. Payloads vary with the tare of the individual box; the figures are one carrier's. | code | inside (mm) | door (mm) | payload | source | |---|---|---|---|---| | 20gp | 5,900 x 2,352 x 2,393 | 2,340 x 2,292 | 30,200 kg | Hapag-Lloyd | | 40gp | 12,032 x 2,352 x 2,395 | 2,340 x 2,292 | 28,800 kg | Hapag-Lloyd | | 40hc | 12,032 x 2,352 x 2,700 | 2,340 x 2,597 | 28,650 kg | Hapag-Lloyd | | trailer-13.6 | 13,600 x 2,440 x 2,650 | side loaded | 24,000 kg | haulier reference values | Trailers are not standardised the way containers are; the figures are the cautious end of the published range, and your haulier's own figures should be preferred. ## Sources - Hapag-Lloyd, Container Specification (general purpose and high cube tables; it also reproduces the ISO 668 external and minimum internal dimensions), https://www.hapag-lloyd.com/content/dam/website/downloads/press_and_media/publications/15211_Container_Specification_engl_Gesamt_web.pdf - ISO 668:2020, Series 1 freight containers: classification, dimensions and ratings; ISO 1496-1, general cargo containers. - PLS Transport, "Trailer dimensions: technical guide", https://pls-transport.be/en/articles/trailer-dimensions ; Calcargo, "Trailer dimensions: what fits inside", https://calcargo.eu/en/blog/trailer-dimensions-what-fits-inside