This calculator takes a finite sequence of real numbers and computes its type-II discrete cosine transform (DCT-II). The output is a list of coefficients that show how much each cosine "frequency" contributes to your original data. This is the same core operation used in JPEG image compression and many audio codecs.
You can use the tool to:
For a sequence of length N, written as
x[0], x[1], ..., x[N − 1],
the DCT-II produces coefficients X[0], X[1], ..., X[N − 1] defined by
with normalization factors
α[0] = 1 / √N for the DC term (k = 0)α[k] = √(2 / N) for k > 0This is a common "orthonormal" convention: with these factors, the transform is energy-preserving, and you can recover the original sequence using the corresponding inverse DCT (type III) with the same scaling.
In the calculator output, the value at row k is exactly X[k] from the formula above.
After you enter a comma-separated sequence and run the calculation, you will see one coefficient per line or table row. Use the output as follows:
X[0] tells you the average magnitude of the sequence.X[1], X[2], or X[3] are large in magnitude, your data has smooth variation or slow oscillations.k = N − 1 indicate rapid changes, sharp edges, or noise.If you are comparing results to a textbook or another software package, check the normalization. Some references use α[0] = 1/2 or α[k] = 1 without orthonormal scaling. In that case, coefficients will differ by simple constant factors, but their relative shapes will match.
Consider the sequence
1, 2, 0, -1
Here, N = 4. Using the orthonormal DCT-II formula above, the calculator computes approximately:
X[0] ≈ 1.0607X[1] ≈ 1.2247X[2] ≈ -0.3536X[3] ≈ -1.9319How to read these values:
1 to 2 down to -1.If you type 1, 2, 0, -1 into the calculator, your DCT-II coefficients should match these values up to rounding. Small differences (for example, in the fourth or fifth decimal place) are normal due to floating-point arithmetic.
The DCT-II is closely related to the discrete Fourier transform (DFT) and to other cosine and sine transforms. The table below summarizes some key differences that matter in practice.
| Transform | Input type | Output type | Symmetry / basis | Typical uses |
|---|---|---|---|---|
| DCT-II (this calculator) | Real, finite sequence | Real coefficients | Even-symmetric cosine basis | Image and video compression (JPEG), audio coding, feature extraction |
| DFT | Real or complex sequence | Complex coefficients | Complex exponentials (sines and cosines) | General spectral analysis, filter design, convolution via FFT |
| DCT-I | Real, finite sequence | Real coefficients | Even symmetry including endpoints | Some PDE solvers, specific boundary conditions |
| DCT-III | Real, finite sequence | Real coefficients | Cosine basis dual to DCT-II | Inverse transform for DCT-II (reconstruction) |
| Discrete Sine Transform (DST) | Real, finite sequence | Real coefficients | Odd-symmetric sine basis | PDEs with different boundary conditions, some signal models |
Because the DCT-II uses only cosines and assumes even symmetry, it often provides better energy compaction for real-world signals than the DFT applied directly to the same-length real data.
In JPEG and many video codecs, images are split into small blocks (for example, 8 × 8 pixels). Each block is transformed with a 2D DCT (built from 1D DCTs along rows and columns). Most of the block's visual information concentrates in a few low-frequency coefficients, which can be stored with higher precision, while many high-frequency coefficients are heavily quantized or set to zero.
Audio codecs and analysis tools apply the DCT or related transforms to short overlapping frames of audio samples. The resulting coefficients can be shaped according to perceptual models of human hearing. Variants of the DCT are also used to compute Mel-frequency cepstral coefficients (MFCCs), a standard feature set in speech recognition.
Because the DCT-II diagonalizes certain differential operators under even boundary conditions, it appears in spectral methods for solving partial differential equations. In pattern recognition and computer vision, truncated DCT coefficient vectors act as compact descriptors of shape or texture.
0.5, -3.2).0, 1, 0, -1. Spaces are allowed and will be ignored.k = 0, 1, 2, 3). These usually carry most of the structure.If you are exploring signal processing more broadly, it is useful to compare the DCT-II with the discrete Fourier transform on the same data. Many workflows use both: the DCT for real-valued compression tasks and the DFT for general spectral analysis and filter design.