It’s mandatory for an employer to give a reference if:
it’s contractual; eg in an employment contract or settlement agreement, or it has been otherwise agreed between employer and employee
the employment is regulated; eg by the Financial Conduct Authority.
Apart from those circumstances an employer is within its rights to refuse.
But what should an employer look out for? The reference should be accurate and truthful. If it contains unflattering information, it shouldn’t be malicious. If an employee suspects they haven’t gained a job because of a malicious or inaccurate reference they can make an application to the Court. The new employer can have a claim too if the old employer got the reference wrong.
Some employers simply provide a reference recording the dates of the employment and the job title. If employers have this policy, or indeed a policy not to provide references, this should be consistently held and should be made clear in any response to a request for a reference.
Acas webpage “Providing a job reference” is helpful for both employers and employees. Employers should be sure to seek legal advice if they don’t want an ex-employee to see a reference.