Finding balance: a guide to factorio belt balancers
As long as there have been belts, people have run into situations where one belt did not suffice to support their factory. Multiple belts are often required, and these belts often cannot be independent. A splitter spreads the contents of 1-2 input belts evenly over 1-2 output belts, but even two belts may not be enough. But using a combination of multiple splitters, it is possible to arrange them in such a way that the whole does this “even spread” across any number of input and output belts. Such an arrangement is called a “balancer”, and in this guide, you’ll learn how to make them. I will not teach you how to make them as small as possible, instead focusing purely on the amount of splitters and the way they are connected. At the end of the day, the rest is just routing, and a lot of designs are easier to understand when you don’t try to compress them.
We will start with some boring sections about methodology and definitions, feel free to skip those if you just want to get to the balancers.
This guide was written in game version 0.16.51, from which all screenshots originate. It was last updated on patch 0.17.60. Most of this information has been relevant for years, though, and will probably remain so.
Honestly? Barely ever. They are useful when you need a number of belts to be drained evenly of filled evenly, which is only really needed at train stations (for filling or draining the wagons evenly). For main buses, priority splitters blow balancers out of the water, as they guarantee full saturation of the split off belts, make it easy to see how many belts you have left, and usually require fewer splitters than the UTU (or even non-UTU) designs one would use in their place. Having all belts on your bus drained evenly certainly has aesthetical value, but little practical use.
That said, aesthetical value may matter to you. If so, this is the guide for you.
In this guide, I will use the following terms and symbols:
This is how this looks in practice:
Four belts flowing in, four flowing out, indicated by the green lights. As the nixie tubes at the top show, that’s 800 items total, per 7.5 seconds.
These are the properties a balancer can posses:
One more point: there exists no balancer that is FO, FI and non-UTL simultaneously, other than the splitter itself. If such a balancer were to exist, it could serve as any smaller balancer, but it isn’t that simple, unfortunately.
Balancers with as many outputs as inputs is where we will start. The simplest of these is the splitter itself, which is a 2x2 balancer. This is the main tool we’ll be working with throughout this guide. But what if we want something bigger?
We have four belts coming in, four belts going out. What do we do? All we have is splitters.
We’ll label the input belts I1-I4 and their contents A,B,C and D. What we want is to have all output belts (O1-O4) to have a quarter of this content:
But how do we get there? Well, we can start by placing splitters across the input. Now we have placed two 2x2 balancers, but we’re not there yet. We have two belts of (A+B)/2 and two belts of (C+D)/2. How do we mix those?
The answer: more splitters! If both splitters send one belt each to another pair of splitters, we have our desired output. That looks like this:
We have now stumbled upon the golden rule of balancer design, the rule that allows all others:
If that seems unclear, let me explain. An (A*B)x(A*B) has A*B belts in, right? We can therefore split the input into B sets of A belts each. These sets can be internally shuffled using AxA balancers. We now have B sets of A belts (as output of that first step), but within each belt already has the same contents. Now we rearrange the sets, creating new sets each containing one belt out of each set in the previous step. We now have A sets of B belts each, but now all sets already have the same total content. Internally shuffling these sets in a second group of BxB balancers results in completely balanced output. We can visualize this by placing the inputs in a square, here shown for a 6x6:
I[1,1] | I[2,1] | I[3,1] |
I[1,2] | I[2,2] | I[3,2] |
Now we first shuffle the columns, using 2x2 balancers:
(I[1,1]+I[1,2])/2 | (I[2,1]+I[2,2])/2 | (I[3,1]+I[3,2])/2 |
(I[1,1]+I[1,2])/2 | (I[2,1]+I[2,2])/2 | (I[3,1]+I[3,2])/2 |
And then the rows, using 3x3 balancers (yet to be designed):
(I[1,1]+I[1,2]+I[2,1]+I[2,2] | (I[1,1]+I[1,2]+I[2,1]+I[2,2] | (I[1,1]+I[1,2]+I[2,1]+I[2,2] |
(I[1,1]+I[1,2]+I[2,1]+I[2,2] | (I[1,1]+I[1,2]+I[2,1]+I[2,2] | (I[1,1]+I[1,2]+I[2,1]+I[2,2] |
And there was balance.
As we don’t have a 3x3 yet, we’ll show this off by building an 8x8:
4 2x2’s on the left rout their contents into 2 4x4’s on the right. You can swap these numbers around, btw. 2 into 4 vs 4 into 2 doesn’t make a difference.
If you are still in doubt about the utility of this rule, consider this: a balancer for any divisible number can be composed of smaller balancers. This means you only need to design balancers for prime numbers, all the rest will follow. A 3x3, 5x5 and maybe 7x7 will get you a long way.
The golden rule was groundbreaking, but that doesn’t give us those other prime balancers yet. How would you ever make a 3x3 if you can only split your contents in two?
A naïve solution would be to just cut one input and output from a 4x4, but that doesn’t work:
The top belt gets twice the flux of the others. This makes sense, as that top splitter now has no other outlet. What was balanced for 4, isn’t for 3. we need to keep that fourth output open, but where could it possibly go? Well, how about we do this:
Amazing, isn’t it? By just feeding the belt back into the splitter, we have created the first loop of the guide, and isn’t it beautiful? If you want to do the math, every output, including the loop, gets fed one quarter from each input belt, once again including the loop. This means that the flux through the loop, L, follows . Now the math:
In a similar way, you can create a 7x7 by looping an 8x8 once. A 5x5 could be created by triple-looping an 8x8, but looping a 6x6 once takes one fewer splitters:
Here we have our first “loop inside a loop”. It’s not as scary as it looks, though. 3 2x2’s feed 2 3x3’s (designed earlier) to make a 6x6, and an additional loop is placed across to make it a 5x5.
We had it easy with those M=N balancers. We had it easy for more reason than one:
But can’t we just make some prime balancers here too? Yes. A 6x4 can be constructed from 2 3x2’s and 2-3 2x2’s, depending on the order in which you place them. But we don’t have to just design a new balancer whenever M is prime, we have to do it for every configuration where either M or N is prime! You need a 5x3, but that doesn’t give you a 5x4. Or a 4x3.
I will be building both converging (M>N) and diverging balancers in this section (M<N), but such balancers can often (under a couple of conditions I will discuss later) be reversed (literally turn all belts and splitters around) to make a NxM balancer. Like with the M=N’s, there are some strategies here, but a bit of creativity may be required. We will do a couple of examples.
And before we start, I am not an expert on these things. I figured this out while writing this guide. That said, I think I have a pretty good idea on how they work now.
5 is a scary number. Splitting one into four is easy, but how to get in the 5th belt?
As you see, we can’t simply split off a single belt like that. We need something better. As always with loops, let us start with something we can do, but is larger. A 1x8, for example:
but with three outputs empty, our situation hasn’t changed… at all. One half of the input will be routed to the top four outputs, three of which are empty, the fourth one gets everything.
If we were designing a 1x3, the answer would be obvious: loop the spare input back:
That works for a 1x3 because there are as many empty inputs as there are outputs, but a 1x5 has one vs three. It’s almost as if we needed to… merge those outputs… from one to three… perhaps using a contraption I needlessly inserted into a 1x5 section?
You got it. That 3x1 balancer can be reverted, so now, our solution looks like this:
… for a grand total of 10 splitters. It’s a solution, sure, but this is where the real fun starts: minimizing the splitter count.
Because it doesn’t really make sense to split lanes if you’re about to merge them anyway. Look at the top splitter of the 1x8. It splits a belt in two, only for them to be merged back together. If we dropped that splitter, we could build a 2x1 merger instead of a 3x1, so we can dump one splitter in the first section, and two splitters in the second.
And that’s our 1x5 (and a bonus 1x3). The strategy is the same as with our 3x3 earlier: take a 2^y x 2^z design that is bigger on both input and output, and loop the spares back.
One final note on this 1x5 though: every splitter is required here. The bypass through the top two splitters may not seem all that functional at first glance, but the entire thing hinges on the fifth output only getting ⅛ of the input splitter, which means that splitter can receive only ¼ of the input, which means half of it must be sent by another way or it breaks the balance.
For a 4x3, we could use the same strategy as before, where we take an 8x4 and work from there:
It works, but this thing is huge! 11 splitters! And no way to trim it down, i’m afraid: rearranging the inputs would only lead to internal bottlenecks. That said, this is a valid solution.
But there are other people on the internet. Let’s get some inspiration from how they solved the problem:
Delightfully compact, and therefore really hard to understand. Let’s pull this one open, and make it easier for you to see what is going on:
Ingenious, isn’t it? 3=2+1, so if we balance the 4 input lanes between a 2x2 merger (since we don’t care about output balance yet, that means just sending them through) and a 2x1 merger, we end up with the input being balanced across 3 lanes. A 3x3 balancer is tacked on at the end to balance the output. In the same vein, an 8x5 would look like this:
Once again, half the lanes are sent straight forward, while the other half are being merged onto a single lane. Since every input splitter sends one lane to each, this means the 5x5 at the end will get an overall even share of every input lane, which can then simply be balanced to gain balanced output.
So there’s our second strategy: merge the lanes to the correct number, while paying special care to the input balance, then proceed to balance the output.
Let’s do a 3x5. Our first strategy would suggest taking a 4x8 and turning it into a 3x5 using loops. Something like this:
Like with the 1x5, we could probably drop some splitters, but that’s not the point. The point is that this design does this:
Why is it not balancing? We built that loop to take ⅜ of the output and send it back round. ⅜ of 4 belts coming in (including the loop) is 12/8, or 1,5 belts that we’re trying to send along a single belt. This breaks the balance. Luckily, the solution is easy, as we can rout a double belt into that top splitter instead. But that would still use an awful lot of splitters. Maybe we could instead try…
We still need a 3x5, but that’s difficult. Why don’t we try designing a 4x6 and looping it once? That would work! Luckily, 4x6 is easy, a long as you have a 2x3 balancer:
There you go! Note however that it is extremely important that the two inputs are on the bottom splitter, as to not interfere with the loop. In fact, let me show you another picture to make that more clear:
Same balancer, different layout. We can’t loop a 2x4 directly, as we need both inputs, so we spread the contents of the loop across the output splitters using that fourth splitter.
Now, Let’s use this 2x3 as a component in a 4x6:
There we go! now to loop it once:
...and we have our 3x5. Note, however, that we could also have placed the 2x2’s after the diverging segment, but then we would’ve needed 3 of them rather than 2. While this seems wasteful, once we reach the UTU segment you will understand why it may be a good idea.
A throughput unlimited balancer is the ultimate solution to balancer bottlenecks. Since any configuration of available influx can reach any configuration of available outflux, you can slap one of these down anywhere, and it will at worst have no impact on throughput. If UTU is call you care for though, and balance isn’t really a requirement, there are better options, but we will get to those later. Let’s first learn how to build these.
Let’s start with the bad news: a standard M=N=A*B balancer design is not UTU. Any Y input lanes must be able to connect to any Z output lanes, and that doesn’t happen here. Let’s prove this:
In practice, this looks like this:
which translates to this:
This obviously doesn’t work. But can we work from here?
Every AxA sends one lane to every BxB. We need a way to get these lanes back into the same place somehow… To rout them back together… Can you feel it coming?
The standard M=N=A*B designs we made so far had a property: they can be either FI or FO, but not both. However, if we were to make a MxN followed by another MxN, we’d be in the clear. What can be spread one way can be converged in the other way. So a 3x3 UTU would look like this:
As you can see, two full input belts are able to rout to two output belts, no throughput loss. Mission complete!
But wait, what do you say? You think you can cut a splitter? Ah well, let’s get to that, and discuss…
The following section describes an issue that still exists in the 0.16 stable branch of factorio. In 0.17, it is fixed, and looping a standard 6-splitter 4x4 TU balancer will yield a flawless 3x3 TU balancer. This section will be removed in the future, but is left here until 0.17 goes stable.
So about that splitter. The bottom two belts in the previous picture runs through two consecutive splitters in the middle. Cutting one shouldn’t make a difference, right?
Wrong. You are making a critical assumption here, an assumption that I used to make as well, but found out to be wrong while making this guide: you are assuming that the splitter itself is a 2x2 UTU balancer. And while I would certainly wish for that to be true, and it almost is, the reality is a little more nuanced. As soon as loops enter the system, splitters stop being UTU. Do not ask me for an explanation; splitters, while simple in theory, are incredibly complex in their implementation. Researching this problem, I stumbled upon terms like “buffering” and “backpressure” that are well beyond the scope of this document. Just know that a truly UTU balancer cannot cut splitters, and will always have double the splitter count of the non-UTU version. 2^y designs, like the 8x8 shown in the very first picture in this document, get away with it by not having loops, but even they can be broken by adding external loops to the system.
The same principle applies here: allow branches to branch back together by doubling up the balancer. But there are a couple of extra points here:
As an illustration, let’s take a 20x24. We could construct this as a 4x4→5x5→4x4→5x6, but that would not be UTU: if six belts of influx were available, and the only available outflux were the 6 output belts of a 5x6, you would never get full throughput, as that component can only ever output 5 belts. The divergence needs to be at the very front for this not to occur. 5x6→4x4→4x4→6x6. Or 5x6→4x4→6x6→4x4. Or even 5x6→4x4→12x12→2x2! As long as the divergence is at the front, or the convergence at the back, you can do this however you like.
This is the only section of the guide where we will not care about balance. Sometimes you have M input lanes and you need them to connect them to N output lanes, with UTU guaranteed. A UTU balancer would do the job, but that’s an awful lot of splitters, and maybe you don’t need balance. Maybe you want the exact opposite, to fill the output belts in a predetermined order! These designs, where the output belts are prioritized, I will call “compressors”, aimed at sending the input through as few output belts as possible, with the rest of the output belts merely being for overflow.
I considered not writing this section, as I thought it relatively simple, but ultimately, I think it fits in nicely.
Have you ever left clicked a splitter?
You can set priorities! This feature was introduced during 0.16, and it’s very powerful. Output priority means that the prioritized output belt will be fully saturated before the other output belt is even considered, and will remain empty. Input priority means that if there is not enough outflux available to fully drain the prioritized belt, the other input belt isn’t even considered, and will back up. This can be used in a variety of ways but for our purposes, we want to do the following:
Let’s start with a 3x3, and build it up gradually.
For our purposes, we will always try to push the input down, prioritizing the lanes from bottom to top. The yellow arrows indicate the prioritized lane, and as you see, it works quite well. But what if we need to shift lanes up: The bottom input has no way of reaching the top output! We need an extra splitter to solve this:
...and all was well. Or is it? Is this design UTU? the answer is no:
.What is happening? The first splitter functions normally: full input means full output. But the second splitter gets one belt of input, and tries to send that through its bottom first, to the third splitter, where it interferes with the bottom lane.
Now you could just tack on more splitters to solve this, but there’s another way:
Notice the difference? A new yellow arrow has appeared. By setting an input priority on the last splitter, we have solved the issue. However, do not think the output splitters are sufficient for this. Let’s look at this 5x5:
Note how we did this with 10 splitters, where a UTU 5x5 balancer would take 22, and even a non-UTU would take 11. Note also, though, how it is not UTU yet. The minimum number of input priorities to be set is as follows:
If we squint, we could theorize that it is sufficient to have everything except the input splitters input prioritized. However, I have thus far been unable to prove that in general, so I will suggest an alternative: there is no harm in setting input priorities on every splitter. The only real side effect is that, aside from pushing to the bottom belts first, it will also pull from the bottom inputs first. Whether this is undesirable is debatable, I think it doesn’t really matter, and it simplifies the system significantly. Let’s do a 4x4 to round it off:
As you can see, the rule is: as many rows of splitters as there are belts. It’s really quite simple.
You remember how M!=N was way harder than M=N with balancers. With compressors, it’s dead easy. All belts are prioritized, and the design is UTU, so cutting any number of input or output belts will give you a valid compressor for the new M and N. This is a valid 4x5:
… which is probably the most common use case for a M!=N compressor: you want to split off one lane to go towards production, and you want that lane to be fully saturated at all times.
I am by no means the ultimate guru on balancer design. Researching the M!=N section was a learning experience for me as well, and that section is not unlikely to be revised in the future. Nonetheless, we did it: every balancer is possible, every balancer can be built. Remember the golden rule, loop some bigger designs if you’re uncertain, and nothing can go wrong.
latest revision: 01/08/2019 (revision 1.3: some adaptations regarding 0.17 changes)
previous revisions: