Fast Fourier Transform Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

What is the Fast Fourier Transform (FFT)?

The Fast Fourier Transform (FFT) is an efficient algorithm for computing the Discrete Fourier Transform (DFT) of a finite sequence. The DFT converts data from the time (or spatial) domain into the frequency domain, revealing which sinusoidal components are present and how strong they are.

A direct DFT for a sequence of length N requires on the order of N2 operations. The FFT reduces this to roughly N log2 N operations by reusing intermediate results. For practical purposes, this means that even quite long signals can be transformed very quickly.

Suppose you have a sequence of samples

x[n], n=0,1, , N-1

The DFT produces complex coefficients

X[k], k=0,1, , N-1

defined by

X[k] = ∑ n=0 x[n] ⁢ e -2πi kn /N

This formula is what the FFT computes, but it does so using a much faster algorithm, especially when N is a power of two.

How the FFT algorithm works in this calculator

This calculator uses a radix-2 Cooley–Tukey FFT. It assumes the length of your input sequence is a power of two (for example 4, 8, 16, 32, 64, and so on). Internally, the algorithm repeatedly splits the sequence into its even and odd indices, computes smaller FFTs, and then combines those partial results using complex exponentials (often called twiddle factors).

At a high level:

The complexity grows roughly as N log2 N, so doubling the length does not double the work; instead it increases it by a relatively modest factor.

How to use this FFT calculator

The form above lets you paste or type a finite sequence of samples and compute the FFT:

You can experiment with simple patterns (like pure tones, impulses, or step changes) and see how the output changes.

Formulas and interpreting FFT output

The FFT output values X[k] are complex numbers. Each one encodes both a magnitude and a phase:

Given a complex FFT coefficient X[k] = a + bi, you can compute magnitude and phase as:

|X[k]| = a2 + b2 phase (X[k]) = atan2 (b,a)

Here atan2(b, a) is the two-argument arctangent that returns an angle in radians, correctly handling all quadrants.

To relate bin index k to real-world frequency, you need the sampling rate fs (samples per second) of your original data. The calculator itself operates on sample indices and does not assume any particular sampling rate, but if your data comes from a physical measurement, the approximate frequency corresponding to bin k is

f[k] = kfs N

for k = 0, 1, …, N-1. In many practical applications, we are mainly interested in k from 0 up to N/2, because the rest of the spectrum is redundant for real-valued signals.

Worked example

Consider the simple four-sample sequence

x = [0, 1, 0, -1]

Assume one sample per unit time (the exact sampling rate does not matter for the structure of the FFT). This sequence roughly corresponds to a discrete-time sine wave at half the sampling rate.

The four-point FFT yields:

Interpretation:

You can enter 0, 1, 0, -1 into the calculator to reproduce this result.

Additional example: sine wave plus noise

As a more practical example, imagine sixteeen samples from a signal that is approximately a pure tone at one frequency plus some small noise. A simplified, normalized sequence might look like:

0.0, 0.7, 1.0, 0.7, 0.0, -0.7, -1.0, -0.7, 0.0, 0.65, 0.95, 0.75, 0.05, -0.65, -0.95, -0.75

If you paste a sequence of this form into the calculator and compute the FFT, the magnitude spectrum will show one or two bins that are clearly larger than the rest. Those correspond to the primary tone. The other bins will be smaller, representing the added noise or small deviations from a perfect sine wave.

In practice, engineers often look at the magnitude of the FFT (sometimes in decibels) to identify peaks that correspond to dominant frequencies in audio, vibration, power signals, and many other domains.

Comparison: DFT vs FFT vs inverse FFT

The terms DFT and FFT are closely related but not identical. The table below summarizes the main differences and relationships.

Concept What it is Computational cost How it relates to this calculator
DFT (Discrete Fourier Transform) The mathematical transform that maps a finite sequence of samples to complex frequency coefficients. Naive implementation needs on the order of N2 operations for length N. This calculator effectively computes the DFT values X[k] for your sequence.
FFT (Fast Fourier Transform) An algorithm family (such as Cooley–Tukey) for computing the DFT much more efficiently. Typical radix-2 FFT requires about N log2 N operations, especially when N is a power of two. The implementation behind the calculator uses an FFT to quickly produce DFT results, especially for power-of-two lengths.
Inverse FFT (IFFT) The algorithm that reconstructs the time-domain sequence from its complex frequency coefficients. Similar cost to the forward FFT: about N log2 N. This page focuses on the forward FFT only. To get back to the time domain, you would need an inverse FFT tool or function.

Common questions when using an FFT calculator

How do I get magnitude and phase?

The raw FFT output is complex. To get magnitude, compute sqrt(real^2 + imag^2) for each bin. To get phase, compute an angle with atan2(imag, real). Many plotting tools use these formulas behind the scenes.

How do FFT bins map to physical frequencies?

If your data was sampled at fs samples per second and the FFT length is N, then frequency bin k corresponds to f[k] = k × fs / N hertz. For example, with fs = 1 kHz and N = 1024, bin k = 100 is approximately 97.7 Hz.

What about power spectrum or magnitude-squared?

The calculator outputs complex FFT values. To approximate a power spectrum, you can compute |X[k]|^2 for each bin and optionally normalize or scale according to your application. This is often used in vibration analysis, audio power measurements, and similar settings.

Limitations and assumptions

To keep the calculator straightforward and efficient, several assumptions and limitations apply:

Practical uses of this FFT calculator

You can use the FFT calculator to explore and prototype many real-world problems, for example:

Related tools and next steps

The FFT is often used together with other operations such as inverse FFT, convolution, and filtering. If your workflow involves moving between time and frequency domains, you may also be interested in tools for inverse transforms, discrete-time convolution, simple digital filters, and window function generation. Linking these tools in your own analysis pipeline can make frequency-domain exploration faster and more reliable.

Provide a sequence of numbers.

Embed this calculator

Copy and paste the HTML below to add the Fast Fourier Transform Calculator - Compute Spectra Quickly to your website.