Gemini protocol overview

A practical summary of the Gemini protocol for developers building clients, servers, or tools. This is not the authoritative spec — it is a working reference for common implementation needs.

The canonical specification is maintained at gemini.circumlunar.space (check the /docs/ path). When in doubt, the spec takes precedence over this page.

The basics

Gemini is a request/response protocol over TLS. Each transaction is one request and one response, on a single connection that closes when the response is complete.

Request format

A Gemini request is a single line:

Maximum length: 1024 bytes including the \r\n.

The URL must be an absolute URL (including the scheme). Example:

That is the entire request. No headers, no method, no version string.

Response format

A Gemini response starts with a header line:

For success responses (2x), the body follows immediately after the header line. There is no blank line separator — the body starts right after the \r\n.

For all other responses, there is no body.

Status codes

1x — Input required

The server is asking the client for input. META is a prompt string displayed to the user.

The client re-sends the same URL with the user's input appended as a query string.

2x — Success

META is the MIME type of the body.

For Gemini pages: META is typically `text/gemini; charset=utf-8`. The body is gemtext.

3x — Redirect

META is the new URL.

4x — Temporary failure

META is a human-readable error message. The client may try again later.

5x — Permanent failure

META is a human-readable error message.

6x — Client certificate required

TLS requirements

TLS is mandatory. There is no plaintext mode.

Gemini does not require certificates to be signed by a CA. Clients typically use TOFU (trust on first use): they accept any certificate on first connection and remember it, warning on changes.

Minimum TLS version: 1.2. TLS 1.3 is preferred.

SNI (Server Name Indication) must be sent by the client. Servers use SNI to select the correct certificate when virtual hosting.

Gemtext MIME type

The MIME type for gemtext is:

The charset parameter is optional but recommended:

A server can serve other MIME types (images, plain text, etc.) over Gemini — the client receives them as downloads or inline depending on the client's implementation.

Client certificates

Gemini includes support for client certificates (6x response codes). This is used for access control and stateful applications (like login flows) without cookies or sessions.

If a client certificate is present, it is passed as TLS client authentication. Servers can read the certificate's subject and expiry to authorise or identify the client.

What Gemini does not have

By design:

These omissions are intentional. The protocol is meant to stay small.

Back to developing index

Last reviewed: 2026-04-07

Corrections welcome: smdocs@pm.me