The 1917 Kilkenny City by-election was held on 10 August 1917. It followed the death of the incumbent Irish Parliamentary Party MP, Pat O'Brien. It was won by the Sinn Féin candidate W. T. Cosgrave, who defeated John Magennis, a three-time Mayor of Kilkenny. Cosgrave won while he was in prison for his role in the Easter Rising.
Magennis went on to be Mayor on three more occasions, while Cosgrave went on to serve for ten years as President of the Executive Council of the Irish Free State.