In Maryland, the U.S. highway runs east-west, for from the Virginia state line at the Potomac River at Sandy Hook east to its northern (eastern) terminus at US 15 and US 40 (the Frederick Freeway) in Frederick. US 340, which is known for most of its length as Jefferson National Pike, connects Frederick with the communities of Jefferson, Brunswick, and Knoxville in the southern part of the Middletown Valley of western Frederick County and Weverton in far southern Washington County. The U.S. highway also links Frederick with Harpers Ferry and Charles Town in the Eastern Panhandle of West Virginia. US 340 is a part of the National Highway System for its entire length in Maryland.