Freight Volume Calculator
July 30, 2026 · View on GitHub
Give it a product's external dimensions. It works out what fits on a pallet, what fits in a container, what the best carton would be, and what the freight costs per unit.
A container load is arithmetic. The problem is that it is arithmetic nobody does in their head correctly — a 600 x 400 carton fits 4 to a EUR-1 pallet and 4 to an 1100 x 1100 Asia pallet despite the second deck being 26% larger, and the pallet that fits the deck best often fits the container worst. This plugin does the geometry, states its buffers, and refuses to invent a freight rate.
Skills
| Skill | Purpose |
|---|---|
size-a-shipment | Main entry point. Collects the inputs, runs the others, writes a shipment brief. |
listing-dimensions | Pulls dimensions out of a supplier listing (Alibaba, AliExpress, Amazon, 1688, B2B catalogues) and cross-checks them before anything is computed on them. |
pallet-quantity | Units per pallet across 11 pallet standards: layer pattern, layers, build height, deck utilisation. |
container-load | Units per 20 ft / 40 ft / 40 HC / 45 HC / reefer / 13.6 m trailer, palletised and floor-loaded, with derates and payload limits. |
packing-options | Enumerates master-carton permutations and ranks them by units per container. |
freight-cost | Divides a rate you supply by a computed load: per container, per m3, per pallet, per kg chargeable weight, with price breaks and duty. |
Quick start
S=scripts/freight.py
# What does the reference data contain?
python3 $S units
# Figures copied off a listing: do they even agree with each other?
python3 $S verify --package 40x30x25 --dim-units cm \
--unit 180x130x120 --unit-dim-units mm --per-carton 12 \
--gross-weight 6.0 --net-weight 5.2 --stated-cbm 0.03
# 600 x 400 x 230 mm crate at 1.9 kg, every pallet standard
python3 $S pallet --dims 600x400x230 --weight 1.9
# Units per container, palletised and loose, for a 2,000-unit order
python3 $S container --dims 600x400x230 --weight 1.9 \
--container 20gp,40hc --quantity 2000
# The carton is not fixed yet: what should it be?
python3 $S options --dims 300x200x150 --weight 1.2
# Freight per unit and landed cost, FCL against groupage
python3 $S cost --dims 400x300x250 --weight 6.5 --container 20gp --units 3000 \
--per-container 2400 --per-cbm 95 --min-cbm 2 \
--unit-price 4.20 --price-for 1000@3.95,2500@3.70 --duty-pct 12 --other 350
# Assert the packer against published trade figures
python3 $S selftest
Everything is stdlib Python 3 — no dependencies, no network, no API keys. Inputs
accept --dim-units mm|cm|m|in, and every subcommand takes --json.
A full narrative run with real output is in
examples/worked-example.md.
What it knows
11 pallet standards — EUR-1/EPAL 1, EPAL 2, EPAL 3, EPAL 6 half, quarter pallet, GMA 48 x 40 in, China 1200 x 1000 (GB/T 2934), Asia 1100 x 1100, ISO 6780 ISO3 and ISO6, Australian 1165 x 1165.
7 transport units — 20 ft GP, 40 ft GP, 40 ft HC, 45 ft HC, 20 ft and 40 ft reefers, 13.6 m EU curtainsider (for the loading-metre basis).
Both live in data/*.csv with a provenance column saying whether a figure is
fixed by a standard, a typical build, or make-dependent and to be verified. Add a
row and every subcommand picks it up.
Why the answers are trustworthy
- The packer reproduces the trade's own figures. 11 EUR-1 pallets in a 20 ft,
25 in a 40 ft, 23 with loading clearance, 33 on a 13.6 m trailer, 9 Chinese
1200 x 1000 in a 20 ft, 10 Australian 1165 x 1165.
selftestasserts 45 such checks, and every layout it returns is validated for overlap and overhang. - It checks the inputs, not just the arithmetic.
verifycatches the ways listings are wrong: product dimensions where the carton was meant, the internal cavity where the external was meant, centimetres read as millimetres, net weight labelled gross, a stated CBM that contradicts the dimensions — and a pack count that does not physically fit the carton, which no amount of careful reading catches. - Buffers are explicit and always reported. 50 mm loading clearance along the container length, 5% derate on floor-loaded figures, zero on palletised ones because that geometry is already exact. All overridable.
- It says when weight binds before volume. Over roughly 250 kg/m3 the container ships part empty and buying volume achieves nothing — the most common surprise in a freight estimate.
- It never invents a rate. There is no rate data in this plugin and no network
call.
costdivides your rate by a load; that is all it does.
Method, limitations and where the packer can be beaten:
docs/methodology.md. Data provenance, ISPM 15, door
height versus internal height, why China builds 1200 x 1000:
docs/reference-data.md.
Install
/plugin marketplace add danielrosehill/Claude-Code-Plugins
/plugin install freight-vol-calculator
Or clone and use the scripts directly — they have no dependency on Claude Code.
Licence
MIT. The reference data is compiled from published standards and carrier specification sheets; verify anything you are contracting against.