The 8.38 miles (13.49 km)Tawa Flat deviation is a double-track section of the Kapiti Line just north of Wellington, New Zealand with two tunnels; the southernmost section of the North Island Main Trunk railway (NIMT) between Wellington and Auckland. It was built to bypass a limited capacity single track section of the original Wellington and Manawatu Railway (WMR) line which ascended from Wellington to Johnsonville and then descended to Tawa Flat. The original name of Tawa Flat was changed to Tawa in 1959.
When opened to passenger trains in June 1937, the deviation reduced the travel time from Wellington to Porirua by 15 minutes, to 27 minutes rather than 43 to 48 minutes. By 2016, the time from Wellington to Porirua had further reduced to 21 minutes for stopping trains, despite extra stops at Redwood, Linden, and Kenepuru which each add 48 seconds to the travel time, and to 17 minutes for non-stopping trains.
The original line from Wellington, constructed by the WMR, wound up the south side of the Ngaio Gorge with steep grades, tight curves, and tunnels with curves in them, to Ngaio, Khandallah, and Johnsonville before descending through difficult hilly country to Tawa Flat.
The new line split from the existing line at Thorndon, where the old line began its ascent to cross the Hutt Road toward Wadestown and Johnsonville. It shared tracks with the Wairarapa Line to the new Distant Junction, where Aotea Quay joins the Hutt Road, where it split from but followed the Wairarapa Line along the waterfront to Kaiwharawhara before climbing a new bank to enter the southern portal of the new No. 1 tunnel (1,238 m). From the northern portal of the new No. 2 tunnel (4,323 m) at Glenside it followed the floor of the Tawa valley down to Tawa Flat where it joined the existing line south of McLellan Street, near the boundary of present-day Tawa College and Tawa Intermediate.
The deviation was the first stage of the duplication and electrification of the NIMT railway from Wellington to Paekakariki. It saved 2.5 miles (4.0 km), lowered the summit level from 518 feet (158 m) to 195 feet (59 m) and reduced the maximum gradient from 1 in 36 (on the initial climb out of Wellington) and then 1 in 40 (to Ngaio) to a maximum of 1 in 100 (in the opposite direction, on the climb south from Tawa). Previously the maximum load out of Wellington for a locomotive was 175 tons, and some trains were banked and then re-formed at Johnsonville. The new NZR Ka class steam locomotives could haul 600 rather than 280 tons, although further north between Plimmerton to Paekakariki they were limited to 490 tons.