Every protocol eventually meets a byte it cannot afford to misread. For Telnet, that byte was 255 — the value it had already reserved to mean a command starts here. The fix was almost insultingly simple: when 255 was genuinely data, send it twice. The first copy opened the door to the command space; the second walked through as payload. That single rule, IAC IAC, is why Telnet could carry a binary file and a terminal negotiation down the same TCP connection without either one devouring the other.

Summary

  • Early Telnet handed the upper half of the byte space to control. The later protocol concentrated command authority in a single prefix — IAC, value 255 — freeing the other 255 values to travel without colliding with standalone command codes.
  • A literal data value 255 crosses the wire as IAC IAC. Negotiated Binary Transmission opens the full eight-bit data range but never switches Telnet control off: receivers still scan for IAC and obey embedded commands.

One byte could be an order; two became a fact

Imagine pushing a binary file through a terminal protocol and the next byte happens to be decimal 255. A receiver that reads the value as “interpret what follows as a command” will swallow part of your file as syntax. A receiver that always reads it as file data will miss a genuine instruction to change an option. The wire carries the same number either way. Only the grammar decides what it meant.

Telnet settled the ambiguity with a grammar small enough to fit in a sentence. A single IAC — Interpret As Command — introduces control. IAC followed by a defined command code invokes that command, sometimes with more bytes trailing to complete it. IAC followed by IAC represents one ordinary data byte whose value is 255. The sender doubles; the receiver spots the pair and strips the framing copy.

Note what this is not. It is not a generic escape meaning “whatever follows is literal.” The second IAC has exactly one meaning in that position; every other following value remains a Telnet command or a piece of Telnet command syntax. Two bytes on the wire become one byte of application data because both endpoints hold the same parser state and agree on the same story.

The rule bought far more than one awkward byte. It let data and control stay interleaved and in order inside a single connection, without permanently sacrificing a large slice of the eight-bit value space.

The first Telnet spent half the alphabet on control

In April 1972, RFC 318 described the official ARPANET Telnet protocol around a Network Virtual Terminal. Values 0 through 127 carried USASCII. Values 128 through 255 were assigned to special control signals.

The split made sense when the common job was wiring unlike text terminals together. A high-valued byte could unambiguously be a protocol action, and seven-bit ASCII still covered the canonical display. But it made richer character sets and arbitrary binary awkward: half of the possible values were simply not available to the application.

RFC 318 named ways to escape into other code sets, including a Transparent mode, then admitted the awkward part — after such an escape, the meaning of Telnet signals, and even the route back to ASCII, could be undefined. Changing the data alphabet threatened the protocol's ability to recognise its own controls.

The problem was constitutional. Attach control authority to many bare byte values, and every expansion of the data vocabulary sends the new data crashing into the old authorities.

A QUOTE proposal exposed the shape of the solution

RFC 435, a January 1973 discussion of Telnet issues, considered making straight binary the default. Its authors proposed augmenting the protocol with a QUOTE character, so that the byte after it would always be read as data. High-valued bytes could then remain a command space while quoted occurrences travelled literally.

That proposal is not the later IAC rule, and it should not be rewritten as though it had been deployed. Its value is diagnostic: it shows the design pressure. Telnet needed an escape boundary that survived changes in how data was interpreted.

Two broad choices existed. Reserve many values for control and quote every possible data collision. Or reserve one distinguished value as the gateway to control, making only that value expensive when it showed up as data. The Internet Telnet specification eventually chose the second — and the second is why the first copy of 255 became a doorway rather than a tax.

IAC compressed command authority into one prefix

RFC 764, published in June 1980, described Telnet as an eight-bit-byte-oriented facility running over one TCP connection, with control information interspersed among data. RFC 854, the May 1983 base standard, kept the architecture.

Every Telnet command begins with IAC, value 255, followed by a command code. Negotiation commands such as WILL, WON'T, DO and DON'T carry a third byte naming the option. Other codes mean end subnegotiation, no operation, Data Mark, interrupt, abort output, erase character, or another base function.

The standard states the trade-off out loud. As negotiation made more comprehensive use of the data space possible, command collisions had to be minimised. Under the IAC design, only IAC itself must be doubled as data; the other 255 byte values pass transparently with respect to base command framing.

“Transparent” here means something narrow. It does not promise that NVT mode leaves every value semantically untouched — NVT still carries character and line conventions. It says those other values are not mistaken for standalone Telnet commands merely because of their numeric value. Command authority has migrated from a whole region of bare bytes to sequences beginning at one gateway.

The command sat exactly where interpretation changed

Because data and control share one stream, ordering becomes a feature rather than an accident. RFC 854 says that when an option affects how data from the command sender should be processed, its negotiation command must be inserted at the point where the sender wants the new interpretation to take effect.

The receiver never gets a detached memo about some unspecified future data. It meets the command between earlier and later bytes. The protocol can therefore draw a boundary inside a single ordered conversation — a switch thrown mid-sentence.

That boundary imposes parser duties. TCP may deliver one IAC now and the following byte later; segment boundaries are not Telnet records. An implementation must retain enough state to know the stream paused after a prefix. It must also decode the doubled form exactly once: leaving both bytes in place corrupts data, while collapsing an IAC command pair as though it were data silently suppresses control.

The transport preserves order. Telnet supplies the grammar. Neither one turns the stream into messages for free.

Subnegotiation nested the same escape rule

Options sometimes need more than a yes or a no. RFC 855 defines subnegotiation as IAC SB, an option code and parameters, terminated by IAC SE. A receiver that does not understand the parameter format can still find the end by hunting for the framing sequence.

But what if a parameter itself contains value 255? RFC 855 applies the general rule: double it. Otherwise a parameter could manufacture what looked like the start of Telnet syntax, or — paired with the next value — a convincing false end marker.

This is recursive framing discipline in miniature. The option governs what its parameters mean, but the base Telnet layer keeps custody of IAC. An extension is never granted permission to redefine the byte that protects the shared stream.

That boundary made ignorance survivable. A base parser could skip to a genuine IAC SE even when the option payload was opaque — provided the sender escaped literal 255 correctly.

Binary mode opened eight bits without switching control off

The decisive test was arbitrary binary data. RFC 856 defines Binary Transmission, option 0. It is negotiated separately in each direction: one party can agree to receive eight-bit binary while the reverse direction stays under its previous interpretation.

Once active, bytes not preceded by IAC are interpreted as eight-bit binary data. Yet IAC IAC still means the data value 255, and IAC followed by an effective Telnet command remains a command. Binary changes the treatment of data; it does not make the whole TCP stream opaque to Telnet.

This is where the prefix design earns its keep. Had control still occupied every value from 128 to 255, binary mode would have had to quote half the alphabet or abandon commands entirely. Concentrating control at one value lets nearly all binary values travel untouched and still preserves option changes inside the same connection.

Binary is therefore not “raw TCP after negotiation.” It is a Telnet data convention sitting beneath a Telnet framing invariant.

Host requirements made the exception impossible to forget

By October 1989, RFC 1123 turned the behaviour into explicit host requirements. Because Telnet options may appear anywhere in the data stream, an IAC sent as data must be doubled. After a successful Binary negotiation, receivers must still scan for IAC, obey embedded commands, and require the doubled data value 255.

Other transformations do change. Binary mode must not apply the ordinary carriage-return substitutions or the end-of-line convention. The control escape stays. That contrast kills a common implementation shortcut: “binary” may disable text normalisation, never the Telnet parser.

The current IANA Telnet Options registry keeps the option namespace and its references, including Binary Transmission at option 0. The registry is not a deployment census. It also illustrates a scope distinction worth remembering: an option numbered 255 is not the same object as a data-stream IAC byte whose value is 255. Numeric equality does not merge protocol roles.

One repeated byte preserved one ordered conversation

Telnet's escape rule is easy to dismiss as wire trivia. It actually separates three authorities. The application chooses data, including whether that data contains value 255. The Telnet sender encodes the value so it cannot accidentally acquire command meaning. The Telnet receiver owns the parser that tells the doubled representation apart from a genuine instruction.

No central service inspects the session. No command needs a second connection. The common layer defines one small invariant that every option and every data mode must respect. Extensions may change echoing, terminal type, character interpretation or record boundaries, but none of them may quietly appropriate IAC.

The cost is permanent. Every implementation must scan; every literal 255 burns an extra wire byte; incomplete prefixes require state; incorrect escaping desynchronises everything that follows. The gain is permanent too: data and control can evolve together without a data value ever being mistaken for authority.

The byte had to repeat itself not because duplication made it stronger, but because the first copy surrendered command meaning so the second could remain data.

Sources and limits

The early half-space design comes from RFC 318; the QUOTE discussion from RFC 435. RFC 764 and RFC 854 supply the interspersed stream and the IAC grammar. RFC 855 supplies subnegotiation escaping, RFC 856 Binary behaviour, RFC 1123 host requirements, and the IANA registry the option namespace. These sources do not establish present deployment share, product conformance, parser safety, encryption, authentication, or one historical implementation date for every host.