  Quantum field theories (QFT) in the presence of defects exhibit new types of
anomalies which play an important role in constraining the defect dynamics and
defect renormalization group (RG) flows. Here we study surface defects and
their anomalies in conformal field theories (CFT) of general spacetime
dimensions. When the defect is conformal, it is characterized by a conformal
$b$-anomaly analogous to the $c$-anomaly of 2d CFTs. The $b$-theorem states
that $b$ must monotonically decrease under defect RG flows and was proven by
coupling to a spurious defect dilaton. We revisit the proof by deriving
explicitly the dilaton effective action for defect RG flow in the free scalar
theory. For conformal surface defects preserving ${\cal N}=(0,2)$
supersymmetry, we prove a universal relation between the $b$-anomaly and the 't
Hooft anomaly for the $U(1)_r$ symmetry. We also establish the
$b$-extremization principle that identifies the superconformal $U(1)_r$
symmetry from ${\cal N}=(0,2)$ preserving RG flows. Together they provide a
powerful tool to extract the $b$-anomaly of strongly coupled surface defects.
To illustrate our method, we determine the $b$-anomalies for a number of
surface defects in 3d, 4d and 6d SCFTs. We also comment on manifestations of
these defect conformal and 't Hooft anomalies in defect correlation functions.
