IRC Documentation · Advanced
Read and analyze the format of an IRC message.
An IRC message ends with CRLF. It may contain tags, a source, a command, and parameters. On TCP, a received data chunk is not necessarily a complete line: message splitting precedes their interpretation.
Dialova Team · Verified on
Parsing a line #
@time=2026-10-29T10:00:00.000Z :Alice!alice@cloak.example PRIVMSG #atelier :Bonjour tout le monde| Part | Value of this example | Role |
|---|---|---|
| Tags | @time=… | Metadata, before the first space separator. |
| Source / prefix | :Alice!alice@cloak.example | Author indicated by the server. |
| Command | PRIVMSG | Protocol action. |
| Target parameter | #atelier | Destination. |
| Last parameter | :Hello everyone | A parameter containing spaces; the colon is not part of the text. |
Spaces and last parameter #
The base separator is ASCII space. The last parameter may be preceded by a colon; everything that follows belongs to this parameter, including spaces. A simple split of the entire line on spaces would lose this information.
TOPIC #atelier :
PRIVMSG Bob :texte avec des espaces
PING :jeton-123The first example has an empty last parameter; the second contains text with spaces. Client/Server (C/S) direction markers used in other examples in this guide never form part of the sent bytes.
Length, bytes, and encoding #
The historical IRC message limit is 512 bytes, including CRLF termination. This is not 512 characters: a UTF-8 character can take up multiple bytes. IRCv3 tags have additional limits that do not allow arbitrarily extending the rest of the message.
Historical IRC does not guarantee a single encoding for all text. Modern clients and networks commonly use UTF-8, and the values of IRCv3 tags should be in UTF-8. Check the network policy and handling of invalid input; do not invent automatic encoding negotiation.
A robust parser #
- Accumulate bytes until a complete termination and keep the remaining fragment.
- Handle multiple lines in a network read and a line split across multiple reads.
- Limit memory before waiting indefinitely for a line end.
- Extract and decode the tags area, then source, command, and parameters.
- Do not execute a historical event as a mutation of the current state.
Sources & Verification
Examples use pseudonyms and fictional domains, except for explicitly documented connection points. Network-specific extensions and settings are noted in the text.
- Modern IRC — spécification du protocole client ↗Source Specification · consulted on 2026-10-29
- RFC 2812 — Client Protocol (2000) ↗Source Historical · consulted on 2026-10-29
- IRCv3 — Message Tags ↗Source Specification · consulted on 2026-10-29