The War of 1812 was fought from June 18, 1812, when the United States declared war on Britain, until February 17, 1815, when the peace treaty (the Treaty of Ghent) was ratified by the United States Congress. Fighting officially ended with the ratification, although some sporadic battles occurred in remote areas afterward.