A by-election is a special election held to fill a political office when the incumbent has died or resigned.

By-elections are held in most nations that use the Westminster form of government. This includes most commonwealth countries, such as the United Kingdom and Canada. In the United States they are called "special elections", and are held when a seat in the House of Representatives, United States Senate, or state legislature is vacant and there is a long period (typically six months) until the next regular election.

The vast majority of by-elections are unimportant. The governing party normally has a solid cushion so that losing a handful of seats would not affect their position. Because of their inability to greatly affect the governance of the nation, voters feel freer to elect smaller fringe parties. Parties on both the far right and the far left do better in by-elections than in general elections.

However, by-elections can become crucial when the ruling party has only a small margin. In parliamentary systems, party discipline is strong enough so that the one common scenario for a vote of no confidence to occur is after the governing party loses enough by-elections to become a minority government.

Party leaders and media commentators often point to by-election victories as important signals, but very often by-elections hinge far more on local issues and the charisma of the candidates than on national issues or how the voters feel about the governing party.