What is quaternary (base 4)?

Quaternary is a numeral system that uses four digits: 0, 1, 2, and 3. It has a natural relationship with binary since each quaternary digit maps exactly to two binary digits. This makes conversion between the two systems straightforward — for example, quaternary 3 equals binary 11, and quaternary 12 equals binary 0110.

Quaternary notation appears in genetics, where the four DNA nucleotide bases (A, C, G, T) can be encoded as quaternary digits. It is also used in some addressing schemes and fractal mathematics, such as describing positions in quadtrees.

Tool description

This tool generates random quaternary (base 4) numbers using the digits 0 through 3. You can specify the digit length and quantity of numbers to produce. Results update automatically as you change the settings.

Examples

Digits Sample output
4 3102
8 23010312
12 130221033120

Features

  • Generate 1 to 1,000 random quaternary numbers per batch
  • Configurable digit length from 1 to 256
  • One-click copy to clipboard
  • Auto-regenerates output on input changes
  • Newline-separated output for easy parsing

Use cases

  • Encoding and simulating DNA sequences in bioinformatics projects
  • Converting between quaternary and binary for educational exercises
  • Generating test data for quadtree and spatial indexing algorithms