Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

SciPy · Function

fft.ifft

Computes the one-dimensional inverse discrete Fourier transform. It can select the transform axis, adjust its length by cropping or zero-padding, and choose a normalization convention.

How it works

Pass a one-dimensional array or array-like object to transform it back from frequency space. The selected axis is cropped or zero-padded to n when requested, and norm controls scaling; the result is a complex ndarray.

Syntax

scipy.fft.ifft(x, n=None, axis=-1, norm=None, overwrite_x=False, workers=None, *, plan=None)

Parameters

NameTypeDescription
xarray_likeInput array; it can be complex.
nint, optionalLength of the transformed output axis. A smaller value crops the input; a larger value pads it with zeros. If omitted, the input length along axis is used.
axisint, optionalAxis over which to compute the inverse DFT. Defaults to the last axis.
norm{"backward", "ortho", "forward"}, optionalNormalization mode: "backward", "ortho", or "forward". Defaults to "backward".
overwrite_xbool, optionalIf True, the contents of x may be destroyed; defaults to False.
workersint, optionalNumber of workers to use for parallel computation.
planobject, optionalReserved for a future planning interface; currently not used.

Returns

complex ndarray: the truncated or zero-padded input transformed along the selected axis.

Key points

  • Use ifft to convert a one-dimensional frequency-domain sequence back toward its original sample-domain representation.
  • Applying ifft to the output of fft provides the corresponding inverse-transform operation.
  • Use n to explicitly choose the transform length and therefore the length of the output axis.
  • A smaller n discards samples along the selected transform axis before computing the inverse transform.
  • norm chooses the scaling convention from backward, ortho, or forward.
  • The return value preserves the selected transform structure while reflecting any requested truncation or padding.

Common mistakes

  • Choosing n larger than the input length adds zeros before transforming, which changes the sampled signal.
  • Set overwrite_x=True only when the input may safely be modified in place.
  • For multidimensional arrays, omit axis only when the final dimension is the intended transform axis.

Example: Round-trip FFT reconstruction

import numpy as np
from scipy.fft import fft, ifft

signal = np.array([1.0, 2.0, 1.0, 0.0])
spectrum = fft(signal)
recovered = ifft(spectrum)
print(np.real_if_close(recovered))

Transforms a real signal to the frequency domain and reconstructs it with the inverse transform.

When to use it

Signal reconstruction

Recovering time- or sample-domain data from Fourier coefficients.

Frequency-domain pipelines

Applying frequency-domain processing before converting results back to samples.

Axis-specific transforms

Processing rows, columns, or another dimension in multidimensional arrays.

Interview questions

QWhat does scipy.fft.ifft compute?

It computes the one-dimensional inverse discrete Fourier transform of x. By default, it uses the last axis and the backward normalization convention.

Follow-up: How does n affect the operation? It sets the output transform length: shorter inputs are cropped, while longer lengths are zero-padded.

QHow do axis and n control the output?

The axis argument selects the dimension along which the inverse DFT is performed, defaulting to -1. The returned array is transformed along that dimension.

Follow-up: What happens if axis is invalid? NumPy-style axis validation raises an error rather than silently selecting another dimension.

QHow does normalization and overwrite_x affect usage?

norm selects among backward, ortho, and forward normalization modes, with backward as the default. The returned value is a complex ndarray containing the transformed, possibly cropped or zero-padded input.

Follow-up: When is overwrite_x appropriate? Only when modifying the input is acceptable, because True permits its contents to be destroyed.

  • scipy.fft.fft
  • scipy.fft.ifftn
  • scipy.fft.ifft2

Source: ifft. Checked 2026-10-15.