How long can IRC messages be?
The IRC protocol (RFC 1459 § 2.3) limits a single line to 512 bytes including two "end of line" characters, which leaves 510 bytes usable for commands and text.
When you send a message, it looks like:
PRIVMSG #freenode :Hello everyone!
And other users receive something like:
:firstname.lastname@example.org PRIVMSG #freenode :Hello everyone!
All of this must fit within 510 bytes plus the end-of-line characters
So the maximal message length can be calculated like this:
message = 512 - len(":" + nick + "!" + user + "@" + host + " PRIVMSG " + channel + " :" + CR LF)
Or in other words,
message = 496 - len(nick + user + host + channel)
- Your nickname is
- You are connecting from
ident@hostname[5 + 8 bytes]
- You send a message to
- The longest message you can send is 496 - (4 + 5 + 8 + 8) = 471 bytes.
IRC messages are always lines of characters terminated with a CR-LF (Carriage Return - Line Feed) pair, and these messages shall not exceed 512 characters in length, counting all characters including the trailing CR-LF. Thus, there are 510 characters maximum allowed for the command and its parameters. There is no provision for continuation message lines. See section 7 for more details about current implementations