An intensely debated topic is whether political polarization on social media is on the rise. We can investigate this question only if we can quantify polarization, by taking into account how extreme the opinions of the people are, how much they organize into echo chambers, and how these echo chambers organize in the network. Current polarization estimates are insensitive to at least one of these factors: they cannot conclusively clarify the opening question. Here, we propose a measure of ideological polarization which can capture the factors we listed. The measure is based on the Generalized Euclidean (GE) distance, which estimates the distance between two vectors on a network, e.g., representing people’s opinion. This measure can fill the methodological gap left by the state of the art, and leads to useful insights when applied to real-world debates happening on social media and to data from the US Congress.