dft calculator

Interactive DFT Calculator

Use this tool to compute the Discrete Fourier Transform (DFT) of a real-valued sample sequence and inspect magnitude, phase, and frequency bins.

Example: 3, 2.5, 0, -1, 4
Leave blank if you only want normalized frequency (k/N cycles/sample).

What is a DFT calculator?

A DFT calculator converts a finite, discrete-time signal from the time domain into the frequency domain. In practical terms, it tells you which sinusoidal components are present in your data, how strong each component is, and what phase shift each one has.

This is useful in signal processing, audio analysis, vibration diagnostics, communications, embedded systems, control engineering, and data science workflows where periodic behavior matters.

The core DFT equation

For an input sequence x[n] of length N, the DFT is:

X[k] = Σ (n=0 to N-1) x[n] · e-j2πkn/N

Each output index k is a frequency bin. The calculator computes Re{X[k]}, Im{X[k]}, magnitude |X[k]|, and phase ∠X[k].

How to use this DFT calculator

  1. Enter at least two samples in the Signal samples box.
  2. Optionally set a sampling rate so the tool can convert bins to Hz.
  3. Choose your preferred decimal precision.
  4. Click Compute DFT.

You’ll get a summary and a full spectrum table for all N bins.

How to read the output

1) Bin index k

Represents the spectral slot in the DFT result. Higher k means higher frequency.

2) Real and imaginary parts

These values define the complex number X[k]. They are the direct result of projecting your signal onto cosine and sine basis functions.

3) Magnitude |X[k]|

This is the amplitude strength at bin k. Large values indicate strong periodic content.

4) Phase (degrees)

Phase shows time alignment/shift for each spectral component. It can be critical in reconstruction and filter design.

5) Frequency (Hz)

If sampling rate is provided, bin frequency is calculated as f[k] = k·fs/N.

Worked mini example

Try the default input: 1, 0, -1, 0, 1, 0, -1, 0 with fs = 8 Hz. This sequence is strongly periodic, so energy concentrates into specific bins instead of being spread uniformly. You should see one dominant non-DC bin, indicating a clear tonal component.

Common mistakes and practical tips

  • Too few samples: Small N gives coarse frequency resolution.
  • No windowing: If the signal is not periodic over your frame, leakage may spread energy to nearby bins.
  • Confusing bin with Hz: Always map bins using sampling rate when physical frequency matters.
  • Ignoring DC: k=0 is the average (offset) component, not a tone.
  • Phase misinterpretation: Phase is meaningful relative to your signal model and reference time index.

DFT vs FFT

The DFT is the mathematical transform itself. The FFT (Fast Fourier Transform) is an algorithm that computes the DFT efficiently. This page computes the DFT directly for clarity and educational transparency.

When to use a DFT calculator

  • Inspect harmonic content in measured data
  • Find dominant frequencies in rotating machinery
  • Analyze tones/noise in audio snippets
  • Verify filters and synthetic waveform generation
  • Teach or learn spectral analysis fundamentals

If you want, you can extend this page with zero-padding, window selection (Hann/Hamming/Blackman), one-sided spectra, and inverse DFT reconstruction for deeper analysis workflows.

🔗 Related Calculators