The United States Constitution names the president of the United States the commander-in-chief of the United States Armed Forces. Many presidents, however, also served in the military before taking office. All but 13 of the 45 persons to become president have served.
Of the 32 presidents with military service, 31 have been commissioned officers, of whom five began their careers as regular officers (Jimmy Carter transferred to the Navy Reserve after five years in the Navy). There have been 13 presidents who held general officer rank (four regular officers, six militia officers, three volunteers).