Education level (grade) Sex Nationality (Spanish/Foreign) Measurement units Total TOTAL Both sexes TOTAL People 47,400,798 TOTAL Both sexes Spanish People 41,998,096 TOTAL Both sexes Foreign People 5,402,702 TOTAL Males TOTAL People 23,248,611 TOTAL Males Spanish People 20,534,537 TOTAL Males Foreign People 2,714,074 TOTAL Females TOTAL People 24,152,187 TOTAL Females Spanish People 21,463,559 TOTAL Females Foreign People 2,688,628 Primary education or lower Both sexes TOTAL People 6,913,829 Primary education or lower Both sexes Spanish People 5,459,193 Primary education or lower Both sexes Foreign People 1,454,636 Primary education or lower Males TOTAL People 2,906,048 Primary education or lower Males Spanish People 2,182,761 Primary education or lower Males Foreign People 723,287 Primary education or lower Females TOTAL People 4,007,781 Primary education or lower Females Spanish People 3,276,432 Primary education or lower Females Foreign People 731,349 First stage of Secondary Education and similar Both sexes TOTAL People 12,239,237 First stage of Secondary Education and similar Both sexes Spanish People 11,173,414 First stage of Secondary Education and similar Both sexes Foreign People 1,065,823 First stage of Secondary Education and similar Males TOTAL People 6,480,759 First stage of Secondary Education and similar Males Spanish People 5,877,475 First stage of Secondary Education and similar Males Foreign People 603,284 First stage of Secondary Education and similar Females TOTAL People 5,758,478 First stage of Secondary Education and similar Females Spanish People 5,295,939 First stage of Secondary Education and similar Females Foreign People 462,539 Second stage of secondary education and non-upper post-secondary education Both sexes TOTAL People 8,772,226 Second stage of secondary education and non-upper post-secondary education Both sexes Spanish People 7,706,757 Second stage of secondary education and non-upper post-secondary education Both sexes Foreign People 1,065,469 Second stage of secondary education and non-upper post-secondary education Males TOTAL People 4,489,428 Second stage of secondary education and non-upper post-secondary education Males Spanish People 3,969,913 Second stage of secondary education and non-upper post-secondary education Males Foreign People 519,515 Second stage of secondary education and non-upper post-secondary education Females TOTAL People 4,282,798 Second stage of secondary education and non-upper post-secondary education Females Spanish People 3,736,844 Second stage of secondary education and non-upper post-secondary education Females Foreign People 545,954 Higher education Both sexes TOTAL People 12,761,845 Higher education Both sexes Spanish People 11,718,753 Higher education Both sexes Foreign People 1,043,092 Higher education Males TOTAL People 5,916,482 Higher education Males Spanish People 5,448,895 Higher education Males Foreign People 467,587 Higher education Females TOTAL People 6,845,363 Higher education Females Spanish People 6,269,858 Higher education Females Foreign People 575,505 Not applicable (under 15 years old) Both sexes TOTAL People 6,713,661 Not applicable (under 15 years old) Both sexes Spanish People 5,939,979 Not applicable (under 15 years old) Both sexes Foreign People 773,682 Not applicable (under 15 years old) Males TOTAL People 3,455,894 Not applicable (under 15 years old) Males Spanish People 3,055,493 Not applicable (under 15 years old) Males Foreign People 400,401 Not applicable (under 15 years old) Females TOTAL People 3,257,767 Not applicable (under 15 years old) Females Spanish People 2,884,486 Not applicable (under 15 years old) Females Foreign People 373,281