Captain Juan Fanning (April 3, 1824 – January 16, 1881) was a naval officer in the Peruvian military who led a memorable charge against the invading Chilean army during the Battle of Miraflores. Fanning was mortally wounded during the charge.