Abstract : We consider constraints from flavor physics on two-Higgs-doublet models (2HDM) with general, flavor-diagonal, Yukawa couplings. Analyzing the charged Higgs contribution to different observables, we find that $b\to s\gamma$ transitions and $\Delta M_{B_d}$ restrict the coupling $\lambda_{tt}$ of the top quark (corresponding to $\cot\beta$ in models with a $Z_2$ symmetry) to $|\lambda_{tt}|<1$ for $m_{H^+}\lesssim 500$ GeV. Stringent constraints from $B$ meson decays are obtained also on the other third generation couplings $\lambda_{bb}$ and $\lambda_{\tau\tau}$, but with stronger dependence on $m_{H^+}$. For the second generation, we obtain constraints on combinations of $\lambda_{ss}$, $\lambda_{cc}$, and $\lambda_{\mu\mu}$ from leptonic $K$ and $D_s$ decays. The limits on the general couplings are translated to the common 2HDM types I -- IV with a $Z_2$ symmetry, and presented on the $(m_{H^+},\tan\beta)$ plane. The flavor constraints are most excluding in the type II model which lacks a decoupling limit in $\tan\beta$. We obtain a lower limit $m_{H^+}\gtrsim 300$ GeV in models of type II and III, while no lower bound on $m_{H^+}$ is found for types I and IV.