The 2018 Taipei mayoral election was held on 24 November alongside other local elections. Incumbent mayor Ko Wen-je, an independent, was eligible to run for a second term, and he ran against Kuomintang's and the Democratic Progressive Party's Pasuya Yao. Ko was reelected, defeating Ting by only 3567 votes, and was sworn in on 25 December.

Background The Mayor of Taipei is the head of its city government. Since becoming a special municipality in 1994, the mayor has been directly elected by citizens, serves a four-year term, and can be reelected once. As of 2018, four mayors have been elected, serving seven terms total.

Primaries Registration for candidacies were open from 27 to 31 August. Each candidate had to be 30 years of age, lived in Taipei for at least four months, and paid two million New Taiwan dollars as deposit. The finalized list of candidates was released on 9 November and had five names.

Ko Wen-je Ko announced his intentions to run for a second term in an interview with NewTalk news on 22 December 2016. He officially registered his candidacy on 30 August.

Kuomintang Four Kuomintang members announced intentions to run: former representative , former deputy minister of the Mainland Affairs Council , former representative , and Taipei councilor Chang Hsien-yao. Ting won the primaries with a polling average of 47.634%.

Ting's family was from Zhejiang and is a second-generation Waishengren. He has served seven terms as representative since 1990. He ran on restoring elderly pensions cancelled by Ko and expanding the Taipei Metro by completing the Circular line. On gay rights issues, he supported the 2018 referendum and opposes same-sex marriage.

2018 Kuomintang Taipei Mayoral primaries Candidate TVBS United Daily News Polling average 48.395% 46.778% 47.741% 47.634% 17.891% 18.845% 17.878% 18.205% Chang Hsien-yao 17.073% 17.909% 16.723% 17.235% 16.651% 16.468% 17.658% 16.926%

Democratic Progressive Party In the last election, the Democratic Progressive Party had endorsed Ko alongside other pan-green parties. After taking office, Ko criticized several DPP policies, leading to them running their own candidate instead.

Two DPP members announced intentions to run: representative for Taipei's second constituency Pasuya Yao, and former vice president Annette Lu. Su Huan-chih, former Mayor of Tainan, having become dissatisfied with Tsai Ing-wen's policies, left the party and ran as an independent, but later dropped out and ran for reelection instead. On 30 May, the party decided to nominate Yao as their candidate for mayor.

Results Ballots took 10 hours and 35 minutes to count, with the process being completed and results announced at 2:36 AM of the next day. Ko received 580,820, a plurality, and was reelected. Ting challenged the results and demanded the Taipei district court for a recount, which happened from 3 to 10 December. Vote totals were amended, with Ko going down 157 votes to 580,663, and Ting going down 470 to 577,096. With a margin of only 3567 votes (0.3%), the election was one of the closest in Taiwanese history.

Results by district District Ko Wen-je Ting Shou-chung Pasuya Yao Lee Hsi-kun Wu E-yang Total votes Votes % Votes % Votes % Votes % Votes % Songshan 42,315 39.62 46,35343.40 17,285 16.18 417 0.39 425 0.39 106,795Xinyi 47,620 38.94 53,81244.00 19,849 16.23 509 0.41 500 0.40 122,290Daan 60,940 38.53 72,31145.72 23,646 14.95 658 0.41 582 0.36 158,137Zhongshan50,58241.54 46,732 38.38 23,476 19.28 490 0.40 476 0.39 121,756Zhongzheng 33,748 41.65 33,89641.83 12,631 15.58 377 0.46 372 0.45 81,024Datong31,66045.29 20,745 29.67 16,895 24.16 339 0.48 266 0.38 69,905Wanhua43,37941.63 38,520 36.97 21,397 20.53 465 0.44 426 0.40 104,187Wenshan 56,463 38.82 68,54947.13 18,989 13.05 710 0.48 710 0.48 145,421Nangang29,07143.53 26,271 39.33 10,829 16.21 324 0.48 287 0.42 66,782Neihu65,58943.70 61,546 41.01 21,747 14.49 639 0.42 549 0.36 150,070Shilin63,21641.20 55,938 36.45 33,108 21.57 653 0.42 521 0.33 153,436Beitou56,08041.82 52,423 39.10 24,490 18.26 577 0.43 497 0.37 134,067Totals 580,663 41.06 577,096 40.81 244,342 17.28 6158 0.43 5611 0.39 1,413,870

References