When is a Fetus Viable?

From a legal standpoint, a fetus is viable at 28 weeks gestation. There have been some miracle babies born prior to the 28th week and have survived.