Every geographic prefix covers a definite piece of the country. The map shows the eight mainland zones, the districts and regions they cut across, the two archipelagos with codes of their own, and the number you dial in each of them.
How to read the map. The colour patches follow district boundaries, as the reference maps do: zone 21x is Greater Lisbon together with the south bank of the Tagus, 22x is Porto and its neighbouring municipalities, and 26x reaches up the Oeste coast as far as Alcobaça. Each town's dot carries the colour of its own zone — where that colour does not match the patch it sits on, the municipality dials its neighbour's code. Hover a zone to list its codes; type a number or a place name to find it.
The islands. Madeira and the Azores lie about 1000 km southwest and 1500 km west of the mainland, so they are drawn as two framed insets below it, west to east. Each frame is fitted on its own, so the two are not at the same scale — compare their bars. All four island areas belong to the 29x block: Madeira dials 291, and the Azores keep the three historical districts — 292 from Faial, Pico, Flores and Corvo, 295 from Terceira, Graciosa and São Jorge, 296 from São Miguel and Santa Maria. Place names stay in Portuguese, since that is what you look up.
Sources. Prefix list: Wikipedia, Telephone numbers in Portugal (the 20x–29x table). Geometry: Carta Administrativa Oficial de Portugal — municipalities of the mainland, Madeira and the Azores, dissolved by district, NUTS II region and dialling area.