How to Pack Items of Different Sizes Into Multiple Containers
The task is concrete: you have a load of cartons, crates or cases, all with different width, height and depth, and you have more than one container available — possibly of different sizes. You need to decide which item goes into which container, and where it sits inside it.
That is exactly what this article walks through. You will describe the load, submit it to RSJ 3D Packer, read the resulting packing plan, and know how to tell whether the plan is any good. By the end you will have a repeatable procedure you can rerun every time the order book changes.
RSJ 3D Packer treats this as a static 3D bin packing problem with multiple bins: items may be packed in any order, every item and container carries its own width, height and depth (mapped to x/y/z), and the solver works with a 240-second time budget per request. The core is a neural network optimised through neuro-evolution, so plans are heuristically optimised rather than guaranteed optimal — more on that in Step 5.
Why does manual or spreadsheet packing break down here? Because with uniform cartons, packing is arithmetic. With mixed sizes, every placement decision changes the free space for every remaining item, and adding a second container type multiplies the branching. A spreadsheet row per SKU cannot tell you that a 7×8×9 carton fits into the void left above a 11×6×6 stack — a solver can.
Prerequisites: what you need before you start
- An RSJ 3D Packer account. The free 30-day test exposes the Pro feature set, so you can evaluate mixed container sizes, weight limits, rotation restrictions and dangerous goods handling before committing. Sign in or create an account via the application.
- Item data. For each distinct item type: count, width, height, depth, and optionally
weight,itemClass,vertical,riskPoints,riskTypes. - Container data. For each container type: width, height, depth, count, and optionally
weight(maximum load),allowedRiskPointsanditemClass. - A shared unit of measure. Use the same unit — centimetres, for example — for every item and every container. Mixing units is the single most common cause of nonsense results.
- A little 3D bin packing vocabulary. If terms like “bin packing” and “item class” are new, read What Is 3D Bin Packing? A Plain-Language Introduction first and come back.
Step 1: Describe your items and containers
Start by writing down every distinct size, not every physical unit. Fifty-one identical 11×6×6 cartons are one item entry with "count": 51, not fifty-one entries.
Group your load into item types and note the dimensions and counts:
Item A: 11 x 6 x 6 cm, 51 pcs, 12 kg each
Item B: 7 x 8 x 9 cm, 53 pcs, 12 kg each, must stay upright
Item C: 8 x 9 x 10 cm, 57 pcs, 10 risk points, risk types 1 and 2
Do the same for containers, and list each type separately if the fleet is mixed:
Container type 0: 48 x 47 x 46 cm, count 1, max load 2000 kg, 1000 allowed risk points
Container type 1: 60 x 40 x 40 cm, count 2, max load 1500 kg
Two decisions to make now, while you are still in a text file rather than an API client:
- Rotation. By default an item may be rotated out of its upright position. If an item must stay upright, set
"vertical": false. This is available on the Standard and Pro plans. - Weight limits. If loads are weight-constrained, put
weighton the items and a maximumweighton the containers. Also Standard and Pro.
Omitting count on an item or container defaults it to one, which is convenient for one-off containers but easy to forget when you actually have three.
Step 2: Set stacking and dangerous goods rules (if needed)
These constraints are entirely optional. For a simple mixed-size load, skip this step and go straight to Step 3.
Stacking classes. itemClass is an integer. The rule the solver enforces is simple: an item may only be placed on items of a lower or equal class. Heavier or more crushable goods get higher classes; robust base goods get low ones. Items without an explicit class default to class 0, so an item with "itemClass": 1 will never end up underneath an unclassified carton.
Dangerous goods (Pro plan). Three pieces work together:
- Items carry
riskTypes(an array of integers) andriskPoints(a number). - Containers carry
allowedRiskPoints(a number) — the maximum risk load for that container. - The request-level
risksarray declares pairs of risk types that must not travel together.
"risks": [{ "type1": 1, "type2": 2 }]
Independently of all of the above, the solver guarantees that every packed item is supported by the item below it. There are no floating items in a returned plan. If you want to know why that matters and how to spot a violation in a plan from any tool, How to Check a Packing Plan for Floating Items covers it.
Step 3: Submit the packing problem to RSJ 3D Packer
You can submit through the browser application or the JSON REST API at https://3dpacker.rsj.de. Here is a minimal request with two container sizes and three item sizes:
curl -X POST https://3dpacker.rsj.de/solve \
-H "Authorization: Bearer session-1bc90169-1c83-443e-8ed7-b0328aaf78a5" \
-H "Content-Type: application/json" \
-d '{
"containers": [
{ "width": 48, "height": 47, "depth": 46, "count": 1, "weight": 2000, "allowedRiskPoints": 1000 },
{ "width": 60, "height": 40, "depth": 40, "count": 2, "weight": 1500 }
],
"items": [
{ "width": 11, "height": 6, "depth": 6, "count": 51, "weight": 12 },
{ "width": 7, "height": 8, "depth": 9, "count": 53, "vertical": false, "itemClass": 1, "weight": 12 },
{ "width": 8, "height": 9, "depth": 10, "count": 57, "riskTypes": [1, 2], "riskPoints": 10 }
],
"risks": [{ "type1": 1, "type2": 2 }]
}'
A few practical notes on the payload:
itemsandcontainersare required;risksis optional.width,heightanddepthare always required.countdefaults to one.itemClassand risk types are integers;weight,riskPointsandallowedRiskPointsare numbers.- Unknown keys are ignored, so you can carry your own metadata (an order number, a customer ID) in the objects — but be aware a future API field could collide with a key you invented. Prefix custom keys if that worries you.
Authentication. The API expects a bearer session. You obtain one by calling GET /user/{email}?hmac={hmac}, where the HMAC is computed server-side while the user is logged in; the response gives you a session value. Sessions last about a day, so fetch a fresh one rather than storing it long-term. The browser application authenticates with cookies instead.
Where to try this safely. The API sandbox is a live request/response playground with a 3D preview, written in plain JavaScript. It is the fastest way to iterate on a payload before wiring it into anything real. The full field reference lives in the API documentation and as an OpenAPI 3.0 document.
The solver runs for up to 240 seconds and returns an optimised plan. Actual runtime may be shorter depending on problem complexity.
Step 4: Read the packing plan
The response has five parts worth understanding.
packedItems is the placement list — one entry per physically placed item, with the container index and its position:
{ "id": 0, "c": 0, "width": 11, "height": 6, "depth": 6, "x": 0, "y": 0, "z": 0 }
c is the index into the containers array of your request, not a physical container. If your request listed one 48×47×46 container first and two 60×40×40 containers second, then c: 0 and c: 1 are different physical container types — and c: 1 may appear for two distinct physical units. Use the containers block and its first field to map indices back to types and units.
containers reports usage and fill:
{ "width": 48, "height": 47, "depth": 46, "count": 1, "used": 1, "filled": 76.77, "first": 0 }
used tells you how many of that container type the solver actually needed; filled is the fill percentage.
items echoes your item types with a remaining count, and unpackedItems lists whatever did not fit, with the leftover quantity per type:
{ "id": 2, "width": 8, "height": 9, "depth": 10, "weight": 0, "itemClass": 0, "count": 17 }
usedContainers gives you the actual container instances in play. And the response also includes a viewer URL for the interactive 3D view and a link to the API sandbox, so you can look at the plan immediately rather than parsing coordinates by hand. The viewer is embeddable in an IFRAME, and the solution can be downloaded as a GLB 3D model if you want to open it in another tool.
Step 5: Adjust and re-run if needed
The solver is heuristic. Two runs on the same input can differ slightly, and a plan is a good answer, not a proof. Treat the first response as a draft to be interrogated.
If unpackedItems is non-empty:
- Add containers and resubmit — the obvious fix, and often the correct one.
- Relax rotation. Check whether your
"vertical": falseitems are the ones left over. Some may not truly need to stay upright. - Revisit stacking classes. An over-tight class hierarchy can block placements that would otherwise be legal.
If fill percentage is low:
- Change the container mix. Fewer large containers often beat many small ones for mixed loads, but not always — this is worth one or two experiments.
- Check your dimensions. A mistyped depth of 46 instead of 4.6 silently ruins everything.
- Accept partial fill. A 76% fill with everything packed usually beats a 95% fill with 17 cartons left on the dock.
Then resubmit the modified request. The 240-second budget applies per request, so iterating is cheap.
How to confirm it worked
Four checks, all doable in a few lines of Python against the response:
data = response.json()
# 1. Conservation: packed + unpacked == total requested
total = sum(i["count"] for i in data["items"])
packed = len(data["packedItems"])
leftover = sum(u["count"] for u in data["unpackedItems"])
assert packed + leftover == total, (packed, leftover, total)
# 2. Nothing exceeds its container's bounds
container_types = data["containers"]
for p in data["packedItems"]:
box = container_types[p["c"]]
assert p["x"] + p["width"] <= box["width"]
assert p["y"] + p["height"] <= box["height"]
assert p["z"] + p["depth"] <= box["depth"]
- Support. Every packed item needs something beneath it. The solver guarantees this, but check anyway: for each item at
z > 0, there should be one or more items at a lower z whose footprint overlaps. The floating-items article linked below walks through the overlap test. - Visual inspection. Open the viewer URL and rotate the model. Overlaps and oddly balanced stacks are far easier to spot in 3D than in a coordinate dump.
Troubleshooting common issues
Items not fitting at all. Recheck units first — mixing millimetres and centimetres is the classic failure. Then confirm the container is genuinely larger than the item in at least one orientation.
Unexpected unpacked items. Usually a stacking class or a rotation restriction. Set itemClass explicitly on every item rather than relying on the default, and confirm which items are actually marked "vertical": false.
Weight limit exceeded. The response should never exceed a container’s weight, so if the numbers look wrong, verify that item weight values are per-unit and that your container weight is the maximum load rather than the tare weight. Weight limits require the Standard or Pro plan.
Dangerous goods conflicts. Confirm allowedRiskPoints is set on the containers — leaving it off while populating riskPoints on items gives the solver nothing to enforce. Also confirm the risks pairs use the same integer type IDs as the items. This whole feature set is Pro-only.
FAQ
Can RSJ 3D Packer handle multiple container sizes in one request? Yes, on the Standard and Pro plans you can specify multiple container types with different dimensions and counts. The solver will decide how many of each to use.
What happens if some items cannot be packed?
The response includes an unpackedItems list with the remaining counts for each item type, so you know exactly what didn’t fit.
How long does the solver take? The solver works with a 240-second time budget per request. The actual time may be shorter depending on the complexity of the problem.
Can I prevent certain items from being rotated?
Yes, set "vertical": false for any item that must stay upright. This feature is available on the Standard and Pro plans.
Conclusion
Packing mixed sizes into multiple containers is a search problem, and the procedure above turns it into a repeatable pipeline: describe the item types and container types once, decide on rotation and stacking rules, submit, then verify conservation and bounds before you trust the plan.
The RSJ 3D Packer application gives you the whole loop — request, 3D viewer, GLB export — and the free 30-day test runs with the Pro feature set, so mixed container sizes, weight limits, rotation restrictions and dangerous goods are all available to evaluate. When you are ready to go further, Integrate a Packing Solver Into Your Order Management System covers pushing these requests from your own software.
Related posts
- Container Loading Software for Freight Forwarders
- How to Check a Packing Plan for Floating Items
- What Is 3D Bin Packing? A Plain-Language Introduction