Overview

The empty string is the single string that contains no characters. It is the result of choosing zero symbols from an alphabet Σ and is commonly written as ε, λ, or simply two quotes "". When discussing strings over an alphabet, the empty string is the unique string of length zero; see alphabet Σ and the notion of an empty string.

Basic properties

By definition the empty string has length 0. It is unique: there is exactly one string that contains no characters. In many programming languages an empty string literal is written "" and functions that return string length report 0. It should not be confused with a missing value (null) or with control characters that occupy space.

Algebraic role

Under the operation of concatenation (concatenation), the empty string serves as the identity element (identity element) of the free monoid of all strings over an alphabet. Concretely, for any string s, concatenating ε on either side leaves s unchanged: sε = εs = s. This identity property makes ε central in proofs and algebraic descriptions of languages.

In formal languages and regular expressions

In language theory the empty string appears in several standard constructions. The Kleene star of a language always contains ε because it allows choosing zero concatenated copies. In automata, transitions labeled ε (often called epsilon-transitions) allow a machine to change state without consuming input. The empty string is also contrasted with the empty language: a language that contains no strings at all is denoted ∅, while a language that contains only the empty string is {ε}.

Distinctions and common confusions

  • The empty string is not the empty set: ε is an element (a string) while ∅ is a set containing no elements.
  • It is not the same as a null or missing value used by databases and some programming environments.
  • It differs from a null character like '\0' that occupies one byte in memory; '\0' may appear inside strings or mark the end of a C string but is a character, not "no characters".

Uses, examples and importance

Because ε is the neutral element for concatenation it often appears as the base case in inductive proofs about strings and as an edge case in string-processing code. Examples: the Kleene star of {a} is {ε, a, aa, aaa, ...}; many algorithms must explicitly handle empty input strings; regular expressions and grammars use ε to represent productions that produce nothing. These roles make the empty string a simple but fundamental concept across theoretical computer science and practical programming.