{
  "id": "reverse-complement",
  "version": "3b27790bd282",
  "status": "published",
  "name": "Reverse Complement Calculator",
  "question": "What is the reverse complement?",
  "summary": "Gives the reverse complement of a DNA or RNA sequence, read 5′ to 3′, with the complement and the reverse, for the bases A, C, G, T or U and the IUPAC codes for mixed bases.",
  "category": "biology",
  "subcategory": "lab",
  "url": "https://www.acalculator.org/biology/reverse-complement-calculator",
  "markdown": "https://www.acalculator.org/biology/reverse-complement-calculator.md",
  "kind": "function",
  "method": "Complement each base (A–T, or A–U in RNA; G–C; R–Y; K–M; B–V; D–H; S, W and N pair with themselves), then reverse the order.",
  "assumptions": [
    "The sequence is written 5′ to 3′, as is usual; the reverse complement is the partner strand, also written 5′ to 3′.",
    "A sequence with a U is read as RNA, and its complement uses U; a sequence may not have both T and U.",
    "Upper and lower case are kept as typed."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "seq": {
        "title": "Sequence (5′ to 3′)",
        "description": "DNA or RNA bases A, C, G, T or U, and IUPAC codes such as R, Y and N. Spaces, line breaks, numbers and a FASTA header line are ignored.",
        "type": "string",
        "maxLength": 10000
      }
    }
  },
  "outputs": {
    "revcomp": {
      "label": "Reverse complement (5′ to 3′)",
      "description": "The partner strand read 5′ to 3′: the complement in reverse order.",
      "format": "text"
    },
    "complement": {
      "label": "Complement (3′ to 5′)",
      "description": "The partner of each base, lined up under the sequence typed.",
      "format": "text"
    },
    "reverse": {
      "label": "Reverse (3′ to 5′)",
      "description": "The sequence typed, in reverse order, with no base changed.",
      "format": "text"
    },
    "length": {
      "label": "Length",
      "description": "The number of bases (symbols) in the sequence.",
      "format": "integer"
    },
    "kind": {
      "label": "Read as",
      "description": "DNA (A pairs with T) or RNA (A pairs with U, when the sequence has a U).",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "seq": "ATGCGTACGTTAGC"
    },
    "outputs": {
      "revcomp": "GCTAACGTACGCAT",
      "complement": "TACGCATGCAATCG",
      "reverse": "CGATTGCATGCGTA",
      "length": 14,
      "kind": "DNA"
    },
    "text": "The reverse complement (5′ to 3′) is GCTAACGTACGCAT."
  },
  "examples": [
    {
      "given": {
        "seq": "ATGCGTACGTTAGC"
      },
      "expect": {
        "revcomp": "GCTAACGTACGCAT",
        "complement": "TACGCATGCAATCG",
        "reverse": "CGATTGCATGCGTA",
        "length": 14,
        "kind": "DNA"
      },
      "source": "OpenStax, Biology 2e, §14.2 DNA Structure and Sequencing (A pairs with T and G with C; the two strands are antiparallel), https://openstax.org/books/biology-2e/pages/14-2-dna-structure-and-sequencing (retrieved 2026-10-18); hand calculation in content.mdx"
    },
    {
      "given": {
        "seq": "AUGGCUAAC"
      },
      "expect": {
        "revcomp": "GUUAGCCAU",
        "complement": "UACCGAUUG",
        "kind": "RNA"
      },
      "source": "NC-IUB, Nomenclature for Incompletely Specified Bases in Nucleic Acid Sequences, Recommendations 1984 (Table 1: R = A or G, Y = C or T, K = G or T, M = A or C, S = G or C, W = A or T, B, D, H, V, N; Table 2 complements; sequences run 5′ to 3′; T and U are synonyms), https://iubmb.qmul.ac.uk/misc/naseq.html (retrieved 2026-10-18); OpenStax, Biology 2e, §14.2 DNA Structure and Sequencing (A pairs with T and G with C; the two strands are antiparallel), https://openstax.org/books/biology-2e/pages/14-2-dna-structure-and-sequencing (retrieved 2026-10-18); hand calculation in content.mdx"
    },
    {
      "given": {
        "seq": "ACGTRYKMSWBDHVN"
      },
      "expect": {
        "revcomp": "NBDHVWSKMRYACGT",
        "complement": "TGCAYRMKSWVHDBN"
      },
      "source": "NC-IUB, Nomenclature for Incompletely Specified Bases in Nucleic Acid Sequences, Recommendations 1984 (Table 1: R = A or G, Y = C or T, K = G or T, M = A or C, S = G or C, W = A or T, B, D, H, V, N; Table 2 complements; sequences run 5′ to 3′; T and U are synonyms), https://iubmb.qmul.ac.uk/misc/naseq.html (retrieved 2026-10-18); hand calculation in content.mdx"
    },
    {
      "given": {
        "seq": ">EcoRI site\n1 gaattc 6"
      },
      "expect": {
        "revcomp": "gaattc",
        "length": 6
      },
      "source": "OpenStax, Biology 2e, §14.2 DNA Structure and Sequencing (A pairs with T and G with C; the two strands are antiparallel), https://openstax.org/books/biology-2e/pages/14-2-dna-structure-and-sequencing (retrieved 2026-10-18); hand calculation in content.mdx: GAATTC is its own reverse complement"
    }
  ],
  "sources": [
    "Nomenclature Committee of the International Union of Biochemistry (NC-IUB), Nomenclature for Incompletely Specified Bases in Nucleic Acid Sequences, Recommendations 1984 (Eur. J. Biochem. 1985, 150, 1–5; Nucleic Acids Res. 1985, 13, 3021–3030): Table 1 symbols, Table 2 complementary symbols, sequences written 5′ to 3′, T and U as synonyms. https://iubmb.qmul.ac.uk/misc/naseq.html (retrieved 2026-10-18)",
    "OpenStax, Biology 2e, §14.2 DNA Structure and Sequencing: adenine and thymine, and cytosine and guanine, are complementary base pairs; the two strands are antiparallel. https://openstax.org/books/biology-2e/pages/14-2-dna-structure-and-sequencing (retrieved 2026-10-18)"
  ],
  "related": [
    "tm",
    "punnett-square",
    "serial-dilution"
  ],
  "changelog": []
}
