  For an elliptic curve $E$ over a number field $K$, one consequence of the
Birch and Swinnerton-Dyer conjecture is the parity conjecture: the global root
number matches the parity of the Mordell-Weil rank. Assuming finiteness of
$\mathrm{Sha}(E/K)[p^\infty]$ for a prime $p$ this is equivalent to the
$p$-parity conjecture: the global root number matches the parity of the
$\mathbb{Z}_p$-corank of the $p^\infty$-Selmer group. We complete the proof of
the $p$-parity conjecture for elliptic curves that have a $p$-isogeny for $p >
3$ (the cases $p \le 3$ were known). T. and V. Dokchitser have showed this in
the case when $E$ has semistable reduction at all places above $p$ by
establishing respective cases of a conjectural formula for the local root
number. We remove the restrictions on reduction types by proving their formula
in the remaining cases. We apply our result to show that the $p$-parity
conjecture holds for every $E$ with complex multiplication defined over $K$.
Consequently, if for such an elliptic curve $\mathrm{Sha}(E/K)[p^\infty]$ is
infinite, it must contain $(\mathbb{Q}_p/\mathbb{Z}_p)^2$.
