Fuel cells are devices that silently, and without combustion, produce electricity from hydrogen or other fuels. In addition, they also have the benefit of being significantly more efficient than combustion engines. In recent the years it has also been shown that fuel cells can operate in reverse mode and produce hydrogen gas from electricity and water. This hydrogen production, referred to as electrolysis, can be used for efficient fuel production, especially if electricity from renewable energy production is used. Solid oxide fuel cells are the most efficient types of fuel cells, due to their high operating temperatures of 600-900 °C. However, at these temperatures the metallic parts of the fuel cells degrade due to reaction with the oxygen and the water vapor that are present inside the fuel cells. In this thesis, this degradation process, called corrosion, was studied. Selected steels that are used as materials for fuel cell components were studied in atmospheres that were designed to simulate the environment inside a fuel cell. The purpose was to find how changes in the environment inside a fuel cell affected the corrosion of the steel components. The ambition was to obtain an understanding of the underlying corrosion mechanisms from a chemical perspective that could be used for choosing, or developing, better steels for solid oxide fuel cells and solid oxide electrolysis cells. The findings of this thesis illustrated that the type of steel used in fuel cells needs to be chosen based of the intended operating conditions of the fuel cell. As an example, the corrosion mechanism of the steels changed and the degradation rate was accelerated in atmospheres with high water vapor content when the chromium content of the steels was too low. Additionally, a closer-to-reality atmosphere was simulated by exposing a steel simultaneously to air on one side and hydrogen on the other and it was found that corrosion was significantly accelerated compared to when the steel was exposed to only one of the atmospheres. A solution to reduce the degradation rate of steels in fuel cells was also evaluated. It was found that application of a very thin coating of the element cerium (Ce) onto the steel surface could significantly improve the expected service life of the steel components in solid oxide fuel cells and solid oxide electrolysis cells.