Banks are closing branches at the fastest pace in decades, as they leave less profitable regions and fewer customers use tellers for routine transactions.

The number of branches in the U.S. shrank by more than 1,700 in the 12 months ended in June 2017, the biggest decline on record, according to a Wall Street Journal analysis of federal data.

Branch...