The claim: The government is spending record amounts on education in England.

Reality Check verdict: The absolute amount of money in the pot for schools in England is at record levels but once you factor in rising pupil numbers, inflation and running costs, schools will have to cut approximately 8% from budgets by 2020.

Theresa May said at Prime Minister's Questions that spending on education is at its highest level, something she has insisted on a number of occasions.

She was talking about England, because education is a devolved matter and is funded separately in the other UK nations.

But head teachers in England have been raising the alarm about growing holes in their budgets.

When the prime minister talks about record amounts of funding going into education, she is referring to the Dedicated Schools Grant, which is the whole block of money going to schools in England. This stands at £40bn this year.

Baby boom

It is true that this is the biggest pot in cash terms, but, of course, how generous the pot is depends on how many pupils there are in the system.

There was a baby boom in the early 2000s, which has been hitting primary schools for several years and is now moving up through the secondary system.

Between 2009 and 2016, the school system expanded to take in an extra 470,000 pupils.

The Department for Education says that between 2016 and 2025 there will be a further increase in the state school system, up from about 7.4 million pupils to about 8.1 million.

So looking at how much is being spent per pupil is a more meaningful figure.

£3bn cuts

David Cameron in 2015 committed to freezing school spending per pupil in cash terms. The Institute for Fiscal Studies (IFS) warned that this would result in an 8% real-terms cut in school spending per pupil due to inflation and the rising cost of wages, pensions and National Insurance contributions.

This amounts to the biggest fall in spending on each pupil in 30 years.

The National Audit Office estimates that schools will have to make £3bn worth of cuts as a result of these factors.

'Fairer funding formula'

The government is consulting on a new funding formula, which it says will be a fairer way of allocating the cash to schools around the country. Under current plans, almost 11,000 schools stand to gain and around 9,000 will lose funding.

How the funding formula could work

Every pupil would get a basic amount, rising to £4,312 for a GCSE student

A pupil eligible for free school meals (FSM) would get an extra £2,160

An extra £810 per pupil in the most deprived areas

An extra £1,550 for pupils with low prior attainment

An extra £1,385 for speaking English as an additional language (EAL)

The following types of schools would get extra funding:

1.4% for schools outside London with high numbers of pupils living in disadvantaged areas, regardless of whether they get FSM

2.8% for schools with the highest proportion of pupils with low prior attainment

1.3% for small, rural schools

5.3% for primary schools in sparsely populated communities

These are averages - some schools may get more or less

This model is what the Department for Education wants every school to move towards eventually but, for the first two years, transitional protections are in place meaning no school can lose more than 3% of their funding.

This means that the best-funded schools under the current system will still get more than £4,312 basic funding per Year 11 pupil for the two year period because of these protections.

For now, one pupil might attract more funding than another with the same characteristics in terms of deprivation, attainment and so on in another part of the country. The idea is that, eventually, two pupils with the same characteristics will attract the same amount of funding no matter what school they attend.

It's fair to say the majority of the schools at the very bottom of the pile are in urban areas and the biggest winners are mostly in rural areas.

The top 30 winners are almost all in Cumbria, Shropshire and Cornwall, while 13 of the bottom 30 are in London or Birmingham. Other losers are in Coventry, Rotherham and Wakefield.

However, it's not quite as simple as urban loses, rural wins. There is a chunk of losers in the funding formula in Lincolnshire, for example, while some London schools are gaining too because of the changes in the way the government assesses need.

But analysis from independent think tank the Education Policy Institute suggests the gains made by some schools will be wiped out by the overall cuts they will need to make to keep up with rising cost pressures.

Sixth forms squeezed

It's also worth pointing out that the schools budget, which is for five to 16-year-olds, is distinct from overall education spending.

Mrs May claims spending on education is at record levels in absolute terms. In fact, while schools have done well in terms of funding per pupil in the longer term - it will be at least 70% higher in real terms in 2020 than it was in 1990 - the IFS says spending on pupils in sixth forms and further education will be no higher in 2020 than it was 30 years previously.