Encryption2026-06-20

What Is a Cipher? Types and Examples Explained

A cipher is an algorithm that encrypts and decrypts data. Learn the difference between ciphers and codes, plus block, stream, symmetric, and classic cipher types.

cipherencryptioncryptographysecurityaes

What Is a Cipher? Types and Examples Explained

A cipher is an algorithm that transforms readable text (plaintext) into scrambled text (ciphertext) and back again, using a key. Modern ciphers like AES secure virtually all digital data, while classic ciphers like the Caesar or substitution cipher simply shift or swap letters.

Ciphers are the engines of encryption. This guide explains what a cipher is, how it differs from a code, and the main families you'll encounter.

Cipher vs Code vs Encryption

These terms are related but distinct:

  • Cipher — operates on individual symbols (letters, bits) using an algorithm and key. "AES" is a cipher.
  • Code — replaces whole words or phrases with other symbols using a codebook ("the eagle has landed"). Codes need a lookup table, not an algorithm.
  • Encryption — the process of applying a cipher to protect data.

So you use a cipher to perform encryption; a code is a different, table-based scheme.

How a Cipher Works

A cipher has two operations governed by a key:

encrypt(plaintext, key)  → ciphertext
decrypt(ciphertext, key) → plaintext

The key is the secret. The algorithm itself can be public (and good ciphers are — this is Kerckhoffs's principle); security must rest on the key, not on hiding the method. You can experiment with a simple cipher in our Text Encrypt/Decrypt tool.

Classic (Historical) Ciphers

These are easy to understand and easy to break — great for learning:

  • Caesar cipher — shift every letter by a fixed amount (A→D with shift 3). See What Is a Caesar Cipher?.
  • Substitution cipher — replace each letter with another via a fixed mapping.
  • Vigenère cipher — a Caesar shift that changes per letter based on a keyword.
  • ROT13 — a Caesar cipher with shift 13; try it in our ROT13 tool.

All of these fall quickly to frequency analysis or brute force, so they're never used for real security today.

Modern Ciphers: Block vs Stream

Modern ciphers operate on bits, not letters, and split into two families:

Type How it works Examples
Block cipher Encrypts fixed-size blocks (e.g., 128 bits) at a time AES, 3DES, Blowfish
Stream cipher Encrypts one bit/byte at a time as a continuous stream ChaCha20, RC4 (deprecated)

AES (Advanced Encryption Standard) is the workhorse block cipher behind HTTPS, disk encryption, and VPNs. Try it in our AES Encrypt/Decrypt tool.

Symmetric vs Asymmetric Ciphers

Ciphers also differ by how they use keys:

  • Symmetric — the same key encrypts and decrypts (AES). Fast; the challenge is sharing the key.
  • Asymmetric — a public key encrypts and a private key decrypts (RSA). Slower, but solves key distribution.

Most systems combine both ("hybrid encryption"): use RSA to exchange an AES key, then AES for the bulk data. See Symmetric vs Asymmetric Encryption and try public-key encryption in RSA Encrypt/Decrypt.

Frequently Asked Questions

What is a cipher in simple terms? An algorithm that scrambles readable text into unreadable text and back, controlled by a secret key.

What is the difference between a cipher and a code? A cipher works on individual letters or bits with an algorithm; a code replaces whole words or phrases using a codebook.

What are the main types of ciphers? Classic ciphers (Caesar, substitution, Vigenère) and modern ciphers, which split into block and stream — and into symmetric and asymmetric.

What is a block cipher vs a stream cipher? A block cipher encrypts fixed-size chunks of data at once (AES); a stream cipher encrypts data continuously, bit by bit (ChaCha20).

What cipher is used on the internet? AES is the dominant symmetric cipher for HTTPS and VPNs, typically paired with an asymmetric cipher like RSA or ECDHE for key exchange.

Related Reading

From Caesar's letter shifts to AES protecting your bank session, every cipher does the same job: turn meaning into noise that only the right key can reverse.