Whether or not stainless steel is magnetic depends on a number of factors. The alloying elements of the stainless steel and the atomic grain structure (the arrangement of atoms in crystal lattices) affect it’s magnetic properties.
First of all, a metal must contain iron in its chemical composition for it to be magnetic. It must also have a quartz structure designed in a martensitic or ferritic crystal lattice.
Next, the crystal structure must have partially-filled electron shells that create a magnetic dipole moment. This can be seen in the body-centered cubic lattice of a ferritic stainless steel.
Another factor that can influence stainless steel magnetism is the amount of cold working that occurs during fabrication. During cold working, parts that are highly worked - bent, drawn, formed into tubes - become more magnetic as the deformation causes them to change from an austenite structure to a martensite structure.
The resulting magnetic properties of the steel are also affected by the amount of corrosion resistance the stainless steel has achieved through heat treatment. Stainless steels with high concentrations of chromium and sometimes molybdenum provide greater resistance to corrosion than grades that are low in these elements.
However, the presence of ferrite in the stainless steel can reduce its impact toughness at low temperatures or after exposure to high temperature conditions. This can limit its usage in some applications, particularly those involving heavy-duty handling. For those types of applications, it’s wise to either electrically or thermally demagnetize the material.