We construct a complete invariant of oriented connected closed surfaces in S3, which generalizes the notion of peripheral system of a knot group. As an application, we define two computable invariants to investigate handlebody knots and bi-knotted surfaces with homeomorphic complements. In particular, we obtain an alternative proof of inequivalence of Ishii, Kishimoto, Moriuchi and Suzuki’s handlebody knots 51 and 64.