OK maybe not illegal as such but it can’t be used as a sole criteria. You could of course do you own Google search and educate yourself but I’ve copied and pasted some info below for you.
Reality:
To dismiss someone fairly for redundancy you must adopt a procedure that is fair and reasonable in all circumstances. Part of this involves identifying fair selection criteria to determine those members of staff that you will retain and those you will make redundant.
The starting point is to consider criteria that are largely objective and measurable and do not discriminate against individuals who are protected from discrimination. In the past many employers adopted a policy of making redundant those with the shortest length of service (LIFO) as it was both simple and objective. However, since the enactment of equality and anti-discrimination legislation, LIFO cannot be used as the only measure to decide who is going to lose their jobs in a redundancy situation. This is because younger people are most likely to be selected for redundancy and this amounts to a disadvantage based on age and may give rise to a claim for indirect age discrimination.