North American area codes 240 and 301 are telephone area codes for the western half of Maryland. They serve Maryland's portion of the Greater Washington, D.C., metro area, portions of southern Maryland, and the more rural areas in the western portion of the state. This includes the communities of Cumberland, Frederick, Hagerstown, Gaithersburg, Rockville, Landover and Silver Spring.
The main area code, 301, was one of the original area codes established in 1947, and originally covered the entire state of Maryland. From 1947 to 1990, it was possible for telephone users on the Maryland side of the Washington metropolitan area to dial any number in the region with only seven digits. This was possible because the Maryland side of the metro shares a local access and transport area (LATA) with Northern Virginia, which is in area code 703, and the District itself. Every number on the Maryland and Virginia sides of the metro also existed in the District's 202, essentially using 202 for the entire metro. One consequence of this was that no central office codes could be duplicated in the D.C. area. For instance, if 202-574 was in use in the District or 703-574 was being used in Northern Virginia, the corresponding 301-574 exchange in Maryland could only be used in areas at a safe distance from the Washington metro area, such as the Eastern Shore. By the end of the 1980s, the D.C. area was running out of prefixes. To free up available numbers, the suburban use of 202 was ended in 1990.