Kafka
PLAINTEXT keyword
Kafka configuration
Data Streaming
Apache Kafka

What does PLAINTEXT keyword means in Kafka configuration?

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

In Kafka configuration, PLAINTEXT names a listener security protocol that uses no TLS encryption and no SASL authentication. It is common in local development and internal test clusters, but it is usually the wrong choice for production traffic that crosses shared or untrusted networks.

What PLAINTEXT Actually Means

When you see configuration such as:

properties
listeners=PLAINTEXT://:9092

Kafka is being told to open a listener on port 9092 using the plain, unsecured Kafka protocol. “Plaintext” here means the network traffic is readable in transit and the listener itself does not enforce authentication.

That makes PLAINTEXT simple, but not secure.

Common Kafka Listener Protocols

Kafka commonly uses four protocol names:

  • 'PLAINTEXT'
  • 'SSL'
  • 'SASL_PLAINTEXT'
  • 'SASL_SSL'

The differences are:

  • 'PLAINTEXT: no encryption, no SASL auth'
  • 'SSL: encryption, optionally mutual certificate auth'
  • 'SASL_PLAINTEXT: SASL auth, but no TLS encryption'
  • 'SASL_SSL: SASL auth plus TLS encryption'

So PLAINTEXT is the least protected option.

Where You See It in Configuration

You often see it in broker listener settings:

properties
listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://broker1:9092

The name before :// is the listener protocol label. Kafka uses that label together with its security protocol mapping.

In multi-listener setups, you may also see:

properties
listeners=INTERNAL://:9092,EXTERNAL://:9093
listener.security.protocol.map=INTERNAL:PLAINTEXT,EXTERNAL:SSL
inter.broker.listener.name=INTERNAL

Here, INTERNAL and EXTERNAL are logical listener names, while listener.security.protocol.map tells Kafka what real protocol each one uses.

Why It Matters to Clients

Clients must match the broker’s listener protocol. If the broker expects PLAINTEXT, the client should use:

properties
security.protocol=PLAINTEXT

A mismatch causes connection failures. For example, a client configured for SSL cannot successfully talk to a broker listener configured as PLAINTEXT.

When PLAINTEXT Is Acceptable

PLAINTEXT is often acceptable for:

  • local development
  • throwaway demos
  • isolated internal lab environments

Even then, it is still best to understand the risk clearly. It is not “lightweight encryption” or “basic auth mode.” It is simply unsecured transport. That makes it fast to start, but also easy to outgrow once teams share environments or move traffic beyond one trusted machine in practice.

Why Production Usually Needs More

In production, Kafka often carries events, logs, commands, or customer data. Without encryption, anyone with network visibility can read the traffic. Without authentication, access control is much weaker and easier to misconfigure.

That is why production deployments usually move toward SSL or SASL_SSL, depending on authentication requirements.

A Minimal Example

Broker:

properties
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://localhost:9092

Client:

properties
bootstrap.servers=localhost:9092
security.protocol=PLAINTEXT

This setup is small and easy to start, which is why it appears so often in tutorials.

Common Pitfalls

One common mistake is assuming PLAINTEXT means ordinary text messages in Kafka topics. It does not. It refers to the transport security mode, not the record payload format.

Another issue is confusing PLAINTEXT with SASL_PLAINTEXT. The latter still uses unencrypted transport, but it adds SASL authentication on top.

A third problem is mixing listener names and protocol names in multi-listener configurations. INTERNAL is just a label; PLAINTEXT is the actual security protocol mapping in that example.

Summary

  • 'PLAINTEXT in Kafka means no TLS encryption and no SASL authentication.'
  • It is a listener security protocol, not a message payload format.
  • Clients must use a matching security.protocol value.
  • It is convenient for local development but weak for production.
  • In multi-listener setups, protocol mapping determines whether a named listener uses PLAINTEXT, SSL, or another mode.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.