The 44-year-old announced his decision following the Catalan club’s 5-3 home defeat to Villarreal on Saturday.
The result leaves Barcelona fourth in LaLiga, 11 points adrift of surprise leaders Girona.
Xavi, who made over 750 appearances for Barça as a player, has won two trophies as a manager with the Blaugrana. The 2010 FIFA World Cup winner lifted the LaLiga and Supercopa de España titles during the 2022/23 campaign.
Xavi said: “I want to announce that on June 30 I will no longer continue as the coach at Barça.
“I think the situation needs to change course, and as a culer [Barcelona fan], I cannot allow the current situation.
“And mostly as a cul, thinking about the club and about the players as well, I think they will feel more free, they will be calmer. I think we play with too much tension. It's for the benefit of the board, of the club.
“As a cul, as a club person, I believe the best thing is to leave on June 30. Of course, I will give all I have in the four months that are left.
“To explain a bit better, the feeling of being Barça coach is unpleasant, it's cruel. You feel that often there is a lack of respect, you feel they do not value your work, and this wears you down terribly.
“It affects your mental health. I am a positive person but the energy goes down to a point where you think that there is no sense.”
Here are the current favourites – including Brighton & Hove Albion head coach Roberto De Zerbi – to succeed Xavi according to Sky Bet.