Fast Fourier Transform Calculator
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
The DFT produces complex coefficients
defined by
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 input sequence
x[0], x[1], …, x[N-1]is reordered into even and odd positions. - Smaller FFTs are computed recursively until length-1 sequences remain (which are trivial).
- At each stage, pairs of results are recombined using complex rotations
exp(-2πi k / N). - The final result is a sequence
X[0], …, X[N-1]that represents the frequency content of the original data.
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:
- Input format: Enter values separated by commas or spaces, for example
0, 1, 0, -1or1 0 1 0. - Real and complex values: You may enter real numbers (like
0.5or-3) or complex numbers ina+biform, such as1+2ior-0.5-0.75i, as recognized by common math libraries. - Sequence length: The number of values must be a power of two (4, 8, 16, 32, …). If not, the calculator will flag an error or ask you to adjust the length.
- Running the FFT: After entering your sequence, press the button to compute the FFT. The output will be the complex spectrum
X[k]for each integer frequency bink.
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:
- Magnitude:
|X[k]|tells you how strong the component at that frequency is. - Phase:
arg(X[k])(or angle) tells you the phase offset of that component relative to the start of the sequence.
Given a complex FFT coefficient X[k] = a + bi, you can compute magnitude and phase as:
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
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:
X[0] = 0X[1] = 0X[2] = 2X[3] = 0
Interpretation:
X[0]is the DC component (average value). It is zero, which matches the fact that the sequence is symmetric around zero.X[2]is nonzero and purely real, indicating a strong component at frequency bink = 2, which corresponds to half the sampling rate forN = 4.- The other bins are zero, so there are no additional sinusoidal components.
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:
- Power-of-two length: The input sequence length must be a power of two. If the length is not allowed, you may need to pad your data with zeros or trim it.
- Even sampling: The tool assumes your samples are taken at uniform time (or space) intervals. If sampling is irregular, the FFT will not correspond cleanly to physical frequencies.
- No built-in sampling rate: The calculator works with sample indices only. To map bin indices to hertz, you must know and apply your own sampling rate.
- Finite-precision arithmetic: Results are limited by floating-point precision. Very small or very large values may suffer rounding errors, especially after many stages of computation.
- No windowing by default: The input is treated as given. If your data is not periodic in the FFT window, you may see spectral leakage. In practice, you might want to apply a window function (such as Hanning or Hamming) before entering the sequence.
- Forward transform only: This tool only computes the forward FFT, not the inverse transform back to the time domain.
Practical uses of this FFT calculator
You can use the FFT calculator to explore and prototype many real-world problems, for example:
- Audio analysis: Inspect short segments of audio to identify dominant tones, harmonics, and noise components.
- Vibration and condition monitoring: Transform sensor data to spot characteristic frequency signatures of bearings, motors, or rotating machinery.
- Power systems: Analyze current or voltage waveforms to identify harmonics and distortion.
- Signal processing education: Learn how basic signals (impulses, steps, sinusoids) appear in the frequency domain.
- Rapid debugging: Check whether simulated or measured sequences behave as expected in terms of spectra.
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.
