We consider viscosity solutions to two-phase free boundary problems for the p(x)-Laplacian with non-zero right hand side. We prove that flat free boundaries are $$C^{1,\gamma }$$
C
1
,
γ
. No assumption on the Lipschitz continuity of solutions is made. These regularity results are the first ones in literature for two-phase free boundary problems for the p(x)-Laplacian and also for two-phase problems for singular/degenerate operators with non-zero right hand side. They are new even when $$p(x)\equiv p$$
p
(
x
)
≡
p
, i.e., for the p-Laplacian. The fact that our results hold for merely viscosity solutions allows a wide applicability.