Many players have been asking a clear chat command for years. On the Minecraft feedback site you can find suggestions from 2014 and even older. So it looks like it’s one of these long time problem that hasn’t been solved yet (just like the Players Only Pressure Plate, or a way to turn off the tutorial for example).
But even if there isn’t a specific command or mechanic in vanilla Minecraft (i.e. withouth addons or plugins installed) that can do it, there are a couple of solutions to this problem. Let’s see them all.
1 – The tellraw command
This method will work for either your and other players messages in the chat.
The idea is to write many empty lines in the chat. This way the old messages will be moved away from your sight. To do so, you can copy and paste this line in your chat:
/tellraw @a [“\n\n\n\n\n\n\n\n\n\n”]
Each /n will create a new line, so 10 of them should be more than enough. If you do it, your chat will look like this:
If you don’t want to see this big dark grey box, you can set its opacity to 0%. This way the chat box background will completely disappear from your screen (only the background, you will still be able to see new messages).
To do so, go to: Game menu > Options > Chat Settings > Text Background Opacity.
2 – F3+D
This solution will completely solve the problem for those who need it in single player games. In fact, if you press F3 and D at the same time, you will clear all your chat.
It will only clear your messages. If you are playing on an online server you will probably have your chat flooded by other players messages and this method will not be very useful. For that scenario you should still follow the first solution.
3 – Plugins
If you didn’t like the first two solutions, your last hope is to install a dedicated plugin. There are many available online, but this one is one of the best clear chat plugins. It is simple, frequently updated and has many useful features.
If you don’t know how to install plugins, you can check the following videos.