The codes that regulate fire safety measures vary between cities and states. Usually, only commercial buildings that pass a certain number of floors or square feet are required by law to have sprinklers; in some localities, those requirements are more expansive.