William Webster Hansen was born on May 27, 1909 in Fresno, California. He was the older of two surviving sons of William George Hansen and Laura Louise (Gillogly) Hansen. His paternal grandfather had immigrated to the United States from Denmark after the German annexation of Schleswig-Holstein. His mother, the daughter of a non-Mormon missionary to Utah, encouraged her children to be independent.
As a boy Hansen showed a precocious interest in electrical devices and a special aptitude for mathematics. From his father, a hardware merchant, he acquired a familiarity with and love for machine tools.