Telnet is an application-layer protocol that provides a bidirectional, text-oriented terminal session between a client and a remote host over a TCP connection, by default on port 23. Among the Internet protocols, it is one of the oldest still documented as a standard: the core specification, RFC 854, dates from 1983, and its roots reach back to the ARPANET experiments of 1969.
Telnet lets a user type commands on one machine and have them executed on another, as if the keyboard were attached directly to the remote system. Its decisive weakness is that it transmits everything in clear text, including user names and passwords, which is why SSH replaced it for remote administration across the Internet. Telnet survives today mainly as a diagnostic tool, in isolated industrial networks and on legacy network equipment.
How Telnet carries a terminal session
Telnet works by connecting two endpoints to a shared abstraction called the Network Virtual Terminal (NVT). Instead of every client learning the quirks of every remote terminal type, both sides translate their local conventions into the NVT format, which is a 7-bit ASCII character stream with defined meanings for carriage return, line feed and a small set of control functions.
The data stream is mostly plain text, but it is interleaved with in-band commands. Each command begins with the Interpret As Command (IAC) byte, value 255, followed by a command code and, where needed, an option code. Because commands share the same channel as user data, a literal byte 255 in the payload must be sent twice. This design keeps the protocol simple, yet it also means that any observer on the path can read and alter both the commands and the data.
The following table lists the most important Telnet command codes and their purpose in a session.
| Command | Code | Purpose |
|---|---|---|
| IAC | 255 | Marks the next byte as a command |
| WILL | 251 | Sender offers to enable an option |
| WONT | 252 | Sender refuses or disables an option |
| DO | 253 | Sender asks the peer to enable an option |
| DONT | 254 | Sender asks the peer to disable an option |
| SB / SE | 250 / 240 | Start and end of option subnegotiation |
| IP | 244 | Interrupt process on the remote side |
Option negotiation and common Telnet options
Telnet extends the basic NVT through option negotiation, a symmetric handshake in which either side may propose a feature with WILL or DO and the other side accepts or declines. The rule that a party never acknowledges a request for a mode it is already in prevents endless negotiation loops, a subtle requirement that early implementations frequently broke.
Options are defined in separate RFCs and cover echo control, terminal identification, window size and environment variables. The table below summarizes the options that most clients and servers still implement.
| Option | Number | Effect |
|---|---|---|
| Echo | 1 | Remote host echoes typed characters back |
| Suppress Go Ahead | 3 | Enables full-duplex character-at-a-time mode |
| Terminal Type | 24 | Client reports a type such as vt100 or xterm |
| NAWS | 31 | Client reports window width and height |
| Linemode | 34 | Client edits lines locally before sending |
| New Environ | 39 | Passes environment variables such as USER |
The Echo and Suppress Go Ahead pair is what makes a modern interactive session feel responsive: the server echoes each keystroke, so a password prompt can simply stop echoing. The New Environ option has a notable security history, because servers that passed variables to the login program without filtering were exploited to bypass authentication.
Telnet compared with SSH and related protocols
Telnet differs from its successors chiefly in confidentiality, integrity and authentication. SSH, defined in RFC 4251 through RFC 4254, encrypts the channel, verifies the server through a host key and supports public-key authentication, while Telnet offers none of these protections in its standard form.
The comparison below places Telnet next to other remote access and transfer protocols that appear in the same family of Internet protocols.
| Protocol | Default port | Encryption | Main use |
|---|---|---|---|
| Telnet | TCP 23 | None | Legacy terminal access, diagnostics |
| SSH | TCP 22 | Built in | Secure shell, tunneling, automation |
| Rlogin | TCP 513 | None | Historical BSD remote login |
| FTP | TCP 21 | None (FTPS adds TLS) | File transfer with a Telnet-style control channel |
| Telnet over TLS | TCP 992 | TLS | Rare secured variant on some mainframes |
A historical link is worth noting: the FTP control connection reuses Telnet conventions for its command channel, so FTP inherited both the NVT line format and the same clear-text weakness.
Where Telnet is still used
Telnet persists where its simplicity and universal availability outweigh its risks, or where equipment cannot run anything else. Administrators should still treat every remaining deployment as a documented exception rather than a default.
The decision table below shows typical situations and the recommended approach for each.
| Situation | Recommendation | Reason |
|---|---|---|
| Checking whether a TCP port is open | A Telnet client or nc is acceptable | No credentials are sent |
| Testing SMTP, HTTP or POP3 by hand | Acceptable on test systems | Shows raw protocol dialogue |
| Administering routers or servers | Use SSH instead | Passwords would cross the network in clear text |
| Legacy PLC or embedded device | Isolate on a management VLAN | Device may lack SSH support |
| Mainframe 3270 access | Use TN3270 over TLS | Protects session and credentials |
| Text-based bulletin boards | Acceptable for public content | No sensitive data is exchanged |
The port-testing use remains the most common today. Typing a host name and port into a Telnet client quickly shows whether a TCP handshake succeeds, whether a firewall drops the connection or whether the service presents a banner.
Security risks and common mistakes with Telnet
The central risk of Telnet is credential exposure through packet capture. Anyone with access to a shared network segment, a compromised switch or an upstream router can record the session and read the password character by character. Telnet also offers no server authentication, so a man-in-the-middle can impersonate the target host without warning.
- Default credentials on IoT devices: botnets such as Mirai spread largely by scanning for open port 23 and trying factory passwords.
- Exposing port 23 to the Internet: internet-wide scans find such services within minutes of deployment.
- Assuming a VPN makes Telnet safe: the session is still readable at both ends of the tunnel and inside the local network.
- Forgetting to disable the service: many network operating systems keep Telnet enabled after SSH is configured unless it is removed explicitly.
- Relying on obscure ports: moving Telnet to another port hides it only from casual observers, not from scanners.
The practical rule is straightforward: disable the Telnet server everywhere SSH is available, restrict any remaining instance with access control lists, and keep the Telnet client only as a troubleshooting utility.
In simple terms
Telnet is a way to type on a distant computer as if you were sitting in front of it. You open a connection, a text prompt appears, and every command you type runs on the other machine.
The problem is that Telnet sends everything like a postcard rather than a sealed letter. Anyone handling the message along the way can read it, including your password. That is why people now use SSH, which seals the same conversation in encryption. Telnet is still handy as a quick test of whether a service answers, but it should not carry anything secret.
A practical example
A network engineer at a regional logistics company receives a report that outgoing email has stopped. From an internal workstation, she opens a Telnet client to the mail relay on TCP port 25. The connection succeeds and the server returns its SMTP banner, so she types HELO and MAIL FROM by hand and sees the relay reject the sender with a 550 policy error. Within five minutes she knows the problem is a misconfigured relay rule, not a firewall or DNS fault.
During the same review, a scan shows that two older warehouse switches still accept Telnet logins on port 23. The engineer enables SSH, removes the Telnet service from both devices and adds an access list that permits management only from the operations subnet. The outcome is that Telnet remains a diagnostic tool on her laptop but no longer carries administrative passwords across the network.