The East Coast Line () is a  long mainline railway in Sweden, linking the cities of Stockholm, Uppsala, Gävle and Sundsvall, as well as the suburbs north of Stockholm.

History
At the construction of the first Swedish mainline railway network 1856–1891 there was a principle to avoid the coasts. This was for military reasons (protect against attacks, aircraft did not yet exist) and to bring steam powered transport to areas without any. The coasts already had steamboats. The Northern Main Line was built Stockholm–Uppsala–Avesta–Storvik–Ånge. Gävle, Söderhamn and Sundsvall which today are located along the East Coast Line were then connected by branches from the mainline.

The first part of today's East Coast Line was the Stockholm–Uppsala part of the Northern Main Line, which opened on 20 September 1866. It was followed by the Uppsala–Gävle Railway, which was built by a private company and opened 1874. The railway Gävle–Sundsvall–Härnösand was opened 1927 after several years of debate. It was called the East Coast Line, and was built by a company mainly owned by the government and the cities along it. After a revision of the naming of railways in Sweden, the name East Coast Line was given to the railway Stockholm–Uppsala–Gävle–Sundsvall.

On August 7, 2023, an SJ train heading towards Sundsvall derailed between Iggesund and Hudiksvall. The storm Hans flooded a railway embankment and it collapsed following heavy rains. The passenger train, which was carrying some 120 people derailed shortly after 12:30 local time. Three people were taken to hospital.

Electrification 
The first part of the line was electrified in 1906–07 as a part of SJ's electrification trials. In 1926, the Western Main Line between Stockholm and Gothenburg was electrified. As Stockholm's main train depot is located in Hagalund, on the East Coast Line, this part was also electrified at the same time. The whole line was finally electrified in 1934. As all other lines in Sweden, East Coast Line is electrified with .

Improvements
The line was extended to double track between Stockholm and Uppsala as early as in 1906. Some curvy sections were rebuilt in the 70s and the 80s, but most of the improvements were done in the 90s, with the introduction of the tilting high-speed train X2000. In the middle of the 90s, the line was completely overloaded with heavy commuter and long distance services north of Stockholm. In 1996, the work started on the Arlanda Line, a loop line which increased the distance with 3 km. With the introduction of 3 extra trains per hour between Stockholm and Stockholm-Arlanda Airport, the line was extended to four tracks between Stockholm and Skavsta. This also resulted in increased speeds, from . In Skavsta, the old line, which goes over Märsta, diverges from the new line. Märsta serves as the terminus for most of the commuter services. It has been mentioned that the track might get upgraded to run up to 250 km/h but this has not been confirmed yet.

Traffic
Ostkustbanan is the busiest line in Sweden, with 60 trains per hour north of Stockholm. Here is a list of trains which use the line:

X2000: Stockholm – Falun, Sundsvall, Östersund and Härnösand, via Arlanda.
InterCity: Stockholm - Mora, Falun and Östersund/Duved, via Arlanda.
Night Trains: Stockholm - Luleå, Kiruna/Narvik, Åre. Mostly over Märsta.
Regional Trains: Uppsalapendeln. Runs every half-hour between Stockholm - Uppsala. Calls at Märsta.
Commuter Trains: (Södertälje) - Stockholm - Märsta.
Freight trains: To all parts of middle and northern Sweden.

Operating speeds

The two express-tracks north of Stockholm permit running at the Swedish maximum of . The local tracks are limited to . The double-track section between Uppsala and Gävle also permits 200 km/h. North of Gävle, the line consists of single track, mostly with lower speed. Apart from Ljusne-Enånger, around Söderhamn where the old single track was replaced with 40 km new single track in the 1990s with a maximum speed of 200 km/h.

Branch Lines
There are a few branch lines.

 Mälaren Line, diverges directly after Stockholm Central.
 Arlanda Line is technically a branch, despite it has the most traffic.
 Dala Line, the line to Dalarna, diverges directly after Uppsala.
 Örbyhus–Hallstavik Line, a freight line which diverges in Örbyhus.

References

East Coast Line Stockholm–Uppsala on Järnväg.net 
East Coast Line Uppsala–Gävle on Järnväg.net 
East Coast Line Gävle–Sundsvall on Järnväg.net 

Railway lines in Sweden
Unreferenced rail transport articles
Rail transport in Västernorrland County
Rail transport in Gävleborg County
Rail transport in Stockholm County
Stockholm (National Area)
Rail transport in Uppsala County
1927 establishments in Sweden
Railway lines opened in 1927