We propose an intuitive way of how to measure segregation in social and spatial networks. Using random walks, we define the segregation index as the probability that an individual meets an individual from the same social group. The segregation index is a generalization of the isolation index and a homophily index introduced in Currarini, Jackson, and Pin (2009), and it has a closed-form relation to PageRank that facilitates its computation. We also show that the Spectral Segregation Index proposed by Echenique and Fryer (2007) is not continuous with respect to the network structure. Finally, we apply the measure to Spanish census data and to citations data from economics, and rationalize the index as the equilibrium outcome of a game.