Abstract Let K be a number field and S a set of primes of K. We write K S / K {K_{S}/K} for the maximal extension of K unramified outside S and G K , S {G_{K,S}} for its Galois group. In this paper, we prove the following generalization of the Neukirch–Uchida theorem under some assumptions: “For i = 1 , 2 {i=1,2} , let K i {K_{i}} be a number field and S i {S_{i}} a set of primes of K i {K_{i}} . If G K 1 , S 1 {G_{K_{1},S_{1}}} and G K 2 , S 2 {G_{K_{2},S_{2}}} are isomorphic, then K 1 {K_{1}} and K 2 {K_{2}} are isomorphic.” Here the main assumption is that the Dirichlet density of S i {S_{i}} is not zero for at least one i. A key step of the proof is to recover group-theoretically the l-adic cyclotomic character of an open subgroup of G K , S {G_{K,S}} for some prime number l.