As an Amazon Associate I earn from qualifying purchases from

Factorio console commands – what to type and when to type it

Last Updated:

Factorio is an amazing game. Its scope is rarely touched in other games and it is just so addictive, and that is just if you are playing it vanilla. But did you know you can tweak and change just about everything in the game from the console? And even if you did, do you know all the coolest things that you can code into the game’s console to adjust everything to the way you like it? Want items to craft faster, no problemo? How about instant teleportation, you can add that too.

We could make an entire website about all the console commands in Factorio and that would just become overwhelming really quickly, so what we are going to do here is pick out some of the real quality of life highlights and get you started with those.

How to use the console in Factorio

Accessing the console in Factorio is simple. As long as you haven’t altered any key bindings then the default setting is the ‘`’ better know as the tilde key – generally found to the left of the number ‘1’ key. If it doesn’t work, head into your options to make sure you haven’t swapped it out at some point in the past and forgotten about it. It more than likely will work though so don’t stress about that any further.

If you need or what to reassign it, within controls on the options you are looking for the option that says Toggle chat and LUA console. From there just hit the button next to it and press the key you want to you, being careful not to overwrite a key that is already set for another command in your game. Now you can access the Factorio console commands at any time.

Right, let’s get into the console

Useful Factorio console commands

Here you will a selection of what we believe to be the most useful /commands when it comes to playing the game, especially if you want to show off your factories.

Take a screenshot in Factorio

Screenshots are saved without the GUI present

This command allows you to be as simple or complicated as you like when it comes to taking a screenshot. It may be that you just want one of something you are particularly proud of, but did you know you can take screenshots of massive factories with a resolution of up to 16834×16834 pixels. Be warned though, you may get crashes doing this as it takes up a huge amount of CPU resource.

Sometimes taking screenshots of large, complex machinery might help you spot a problem in your design that you just cant see in-game, so it has a use outside of egotistical showing off too.

If you just want to take a bog-standard screenshot, even then you have some options. Let’s take a look at the commands.

/screenshot [resolution x] [resolution y] [zoom]

Here the options in the [xxxx] are exactly that; optional. Just using /screenshot will take the screen as you see it but you can also set the resolution and zoom degree here too. The resolution default is your current window size, so let’s say 1920×1080 for most people. The default for zoom is 1. If you add a value of 2 to zoom your image would be double the size but you would only get half of it. Because, well, that’s what zoom does.

The following command would take a screenshot of your default screen size zoomed into level 2.

/screenshot 1920 1080 2

That is just the basics and there are players over on Reddit who have gone deep into taking whole streams of screenshots and stitching them together. This thread over there is well worth a read if you are interested.

Oh and if you are wondering where does Factorio save your screenshots, when you use the command it saves a screenshot minus all the GUI in your C:Users(username)AppDataRoamingFactorioscript-output folder.

How to mine faster in Factorio

factorio mining
The command is entered after using the tilde key to enter the console

Until you get a mega factory up and running in Factorio, mining can be a little bit of a chore. It’s pretty chilled out at first but when you are waiting for a large number of resources it can also become a pain in the backside.

Fortunately, we can tweak that in the console too.

/c game.player.force.manual_mining_speed_modifier=1

Looking at the above command the only part we need to concern ourselves with really is the modifier. Basically modifier=0 is regular speed, 1=200%, 2=300% and so on. This can really be a boon, especially in the early parts of the game.

How to teleport in Factorio

You have crash-landed on an alien world and have all this ability to make wonderful machines so you think somewhere along the way your species would have developed teleportation skills, wouldn’t you? Well they have, it’s just you need to use the console to achieve it. With the correct command, you can instantly transport yourself to any corner of the map in the blink of an eye. Let’s learn this handy trick.

/c game.player.teleport([x],[y])

This one is pretty self-explanatory. The X and the Y are simply the X/Y coordinates of where you want to go. You should start by noting down the coordinates of all the areas you might want to travel to in the future – such as that big iron mining area you are setting up. You can press F5 and it will tell you the coordinates, or again you can use the console to generate your location.

/c game.player.print('x='' y='

Increase reach in Factorio

factorio cantreach

When I first started out and didn’t really know what I was doing, I found myself constantly clicking on objects further away from my Engineer than the game allows and being given the “object is out of reach message”, then having to wander over to it and repeat the action. Not exactly a huge issue, but I did find it irritating. Obviously, I am not alone and there is a console command that increases your reach so that kind of thing doesn’t happen anymore.

Have a look at the code below.

/c local reach = 200
game.player.force.character_build_distance_bonus = reach
game.player.force.character_reach_distance_bonus = reach

The default figure the game starts with is 10, so my changing it to 200, as per the example above would give you 20 times the reach. You can get silly and be able to stretch across the whole map pretty much without ever having to move from the one spt. Ah, the power.

How to enable Peaceful mode in Factorio

factorio biters

I know being attacked by the Biters is part and parcel of the game in Factorio, but similar to when I played an awful lot of Minecraft, I prefer a more chilled experience that can’t just suddenly be ruined by the RNG of the enemy. To deal with this is it is easy to simply enable Peaceful mode which means the Biters won’t attack you if left alone – a bit like a nice bumblebee in the garden – it can still really hurt you, but it’s generally your fault of it does. Unlike wasps, who are just nasty.

Anyway if you wish to force the Factorio into Peaceful mode, hit tilde and enter the below.

/c game.player.surface.peaceful_mode=true

If you fancy a bit more action in future, just enter the same command but change the flag to the below:

/c game.player.surface.peaceful_mode=false

How to kill all enemies in Factorio console

Of course, you still might need to despatch a troublesome nest of biters if they are in the way of your expansion, and maybe you don’t really want to risk everything with your battle skills. So how wonderful would it be if you could just type a few commands into the console and wizard them away? Guess what…

/c game.forces["enemy"].kill_all_units()

Well, that is going to get rid of every bad guy on the map. Total armageddon for the Biter population. If you would like something a little less nuclear then you can just remove enemies within a certain radius, maybe to solve a problem like we mentioned above.

/c local surface=game.player.surface
local pp = game.player.position
local cnt = 0
for key, entity in pairs(surface.find_entities_filtered({force="enemy", radius=100, position=pp })) do
cnt = cnt+1

This will also rid you of the nests. Again, tweak the radium number to make it more or less effective using the same methodology as described in the Increase Reach command above.

Create a Resource patch in Factorio

factorio copper
A user-generated patch of copper ore

Sometimes you don’t want to spend a lot of time searching the map for a specific resource that you need. Luckily, with a little console command script, we can generate a patch of a given resource under the feet of your character, as long as it is on land. Resources won’t generate on water tiles. Let’s have a look at the code first and then we will dig into it to see how we can tweak it.

/c local surface=game.player.surface
local ore=nil
local size=5
local density=10
for y=-size, size do
	for x=-size, size do
		if a<b then
			ore=math.random(a*density-a*(density-8), a*density+a*(density-8))
		if b<a then
			ore=math.random(b*density-b*(density-8), b*density+b*(density-8))
		if surface.get_tile(game.player.position.x+x, game.player.position.y+y).collides_with("ground-tile") then
			surface.create_entity({name="stone", amount=ore, position={game.player.position.x+x, game.player.position.y+y}})

Coping the above into your console will generate a sizeable, square patch of stone centered on your character. To change the resource generated, simply change where it says stone (bolded) to iron-ore, copper-ore, coal, or uranium-ore.

The code above will give you a randomly generated patch of ore of your choosing that should be good for about 2500 of the resource. If you want a larger patch alter the ‘local size=5’ to something bigger. It is not recommended to go above 30 for processing reasoning.

If you alter the local density, well that will give you a more densely populated patch. Experiment and see what you prefer but again don’t go silly or you risk crashing your game.

Create oil in Factorio

factorio oil

If you need oil rather than the minable resource assets then the following code will generate nine oil patches in a square around your engineer.

/c for y=0,2 do
	for x=0,2 do
		game.player.surface.create_entity({name="crude-oil", amount=100000, position={game.player.position.x+x*7-7, game.player.position.y+y*7-7}})

Create fish in Factorio

We can do something similar to produce a square of the fish resource as well. The only caveat here though is you must run this piece of code while you are standing on the edge of the water.

/c local player = game.player
local surface = player.surface
for i = 1, 10 do
  local position = surface.find_non_colliding_position('fish', player.position, 10, 1)
  if not position then return end
  surface.create_entity {name="fish", position = position}

How to enable Cheat Mode in Factorio

So you like crafting in Factorio but would like a bit more flexibility to just make what you want without the faff of crafting everything from something else. Factorio has the equivalent of Creative Mode in Minecraft, and as you might have guessed, it is enabled through the Console.

It’s worth noting that activating this will remove the opportunity to gain achievements in the game, so if that is your jam, then beware.

Let’s start by activating Cheat Mode with the following:

/c game.player.cheat_mode=true

Obviously enough you can disable it again by changing the flag to false.

Once it is active you can start to do some cool stuff with your inventory. For example, if you want to add a number of items straight into your inventory rather than crafting them, then have a play with:

/c game.player.insert{name="copper-plate", count=100}

The variables here should be obvious if you have been following this whole guide. Replace the item name with what you want and the number with the amount you wish to generate.

factorio inventory
If you would still like to maintain the idea that you are putting at least a little effort into events, but are getting fed up with keeping running out of resources, you can refill all the resources on the map to provide you with an infinite source of everything you have located.
/c surface = game.player.surface
for _, ore in pairs(surface.find_entities_filtered({type="resource"})) do
    ore.amount = 10000

And finally here, if you find your inventory is just too small for your needs, how about adding a further 100 slots to it?

/c game.player.force.character_inventory_slots_bonus=100

Again you can tweak the variable to taste.

Manipulating the map in Factorio

Our final section, for this article at least, is going to look at how we can wield our God-like console powers to affect the very land around us.

It might be that rather than stumbling across any nasty surprises you would prefer to just peruse the entire map from the off and you can do that with a simple console command.

Reveal entire map in Factorio

/c game.player.force.chart_all()

Not though that this will dramatically increase the size of your save game file.

Perhaps a more useful and less abrasive method is to only reveal the map to a certain radius around your Engineer. This can obviously save time wandering off in all directions looking for stuff.

If this sounds more suitable then try entering the following into your console:

Reveal radius around player in Factorio

/c local radius=150
game.player.force.chart(game.player.surface, {{game.player.position.x-radius, game.player.position.y-radius}, {game.player.position.x+radius, game.player.position.y+radius}})

You can tweak the radius number here to make it larger or small and it will be based on where your character is centered when you enter the command.

In conclusion

We have bared scratched the surface here of what you can achieve in the console of Factorio. If you would like to see more and different areas, then leave a comment and we will start to construct Part 2. In the meantime, we hope you have found these console commands useful and opened your eyes to the possibilities of Factorio. Of course, it is also perfectly fine to just play the game as nature intended too, because it really is a lot of fun.

We will be happy to hear your thoughts

Leave a reply

Enable registration in settings - general
Compare items
  • Total (0)
Shopping cart