On a steam locomotive, the firebox is the place where the fuel is burned to generate heat in order to boil the water in the boiler.

The firebox is surrounded on five sides by the boiler. The side that is not part of the boiler is the bottom of the firebox. This contains the grates which hold up the firebed while allowing air to pass through in order to provide oxygen for combustion. Ash falls through the grates and into the ashpan beneath. The ashpan has doors at its front called dampers that allow control of the airflow into the fire.

The top of the firebox is called the crown sheet and is where a large proportion of a locomotive's steam generation takes place. The crown sheet must be covered with water at all times; the intense heat of the fire is most concentrated here, and without that water to cool the metal, it will soon soften and buckle. The softened metal can no longer withstand the pressure of the boiler, and it will burst in a crown sheet failure. The resulting explosive outburst of incredibly hot water and steam will be like a small explosion in the firebox; such an incident is very likely to kill the crew, even if it does not result in a complete boiler explosion.

The front of the firebox is the back tube sheet which is full of holes into which the boiler tubes and boiler flues are welded. The hot gases from the fire are pulled down these tubes, which pass the length of the boiler from firebox to smokebox, by the forced draught generated by the exhaust steam. They then pass out the stack.

The back and sides of the firebox also have water in between them and the outer skin of the boiler. These spaces are known as the water legs (because in cross-section, the boiler looks kind of like a pair of pants). The bottom of the water legs is known as the mud ring because impurities in the water that come out of solution, such as dirt, limescale, rust etc. collect there, at the lowest point in the boiler. These are gotten rid of via blowing down the boiler, or through the boiler washout process that is done periodically.

In order to give the fire gases a longer path, so that complete combustion happens before they enter the boiler tubes, the firebox is often divided into a lower and upper half at the front by a brick arch made of firebrick.