You might be a bit concerned about this question, well, I'll explain it! I want a command block to be searching for anyone saying .clearchat and if it comes out true it will clear chat. Is it really possible(?), and if it is leave an answer below!

  • 1
    Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins!
    – Frank
    Jul 23, 2017 at 14:52
  • Actually, you can use /gamerule <randomWord> <number> in chat, then in a command block gamerule <randomWord> to get the number, then stats to do something based off of that value. But that doesn't help you for your case, because you still have the problem that no command can clear the chat of a player. The player has to press F3+D himself. Apr 30, 2018 at 20:56
  • Well, you could spam the player's chat with empty lines. But again, only with gamerule <randomWord> <number>. Is that also acceptable? Then I already have an answer ready (written months ago, just forgot to post). Apr 30, 2018 at 21:03
  • 5
    Possible duplicate of Can i use the /testfor command to check for certain words in chat?
    – pppery
    Aug 10, 2020 at 21:29

2 Answers 2


Programmes can in theory read the logs of the game to know what has been typed in the chat. However, command blocks cannot. As far as I know, commands can not clear the chat of a player either.

  • Well, that shucks, well I got the clearchat covered.
    – IceBotYT
    Jul 26, 2017 at 22:02
  • Look I know this is old but I want to know a program that can do that. If you know then THATS AWESOME!!! Thanks.
    – IceBotYT
    Oct 12, 2017 at 22:20
  • There's a log file for every Minecraft session. You can read that with any text editor, console, batch script, whatever. Apr 30, 2018 at 20:52

It is not possible for a command block to clear chat however, Building on @aeldrion’s answer, you can clear the chat for yourself by pressing F3 + D. Depending on your keyboard preferences on providing function keys, you may also have to press FN as well for it to work. I’m sorry your objective was not possible and I hope this trick will help you to work around it.

Not the answer you're looking for? Browse other questions tagged .