Home Calculators Categories Category: Math, Statistics & Education

Phase Shift Calculator

This phase shift calculator finds the signed horizontal shift of a sine or cosine function y=Asin⁡(Bx+C)+Dy = A\sin(Bx + C) + D and tells you whether the curve moves left or right. It reports amplitude, period, and vertical shift alongside the phase shift, so you can read all the main wave properties from one set of coefficients. It can also run the other way: enter an amplitude, period, horizontal shift, and vertical shift, and it writes the sine or cosine equation for you. A graph overlays the shifted curve on its unshifted reference so you can check the result visually.

Input
Load an example and edit any coefficient to compare the results.
Choose the trigonometric function in the equation.
y = A sin(Bx + C) + D
Uses the written Bx + C form with radian arguments.
The multiplier outside the function. A negative value reflects the wave across its midline.
The signed multiplier of x inside the function. A larger magnitude gives a shorter period.
The signed constant inside the function. For Bx − π, use −pi.

Enter decimals, fractions, or multiples of π such as pi/4.

Enter the midline height. Positive moves the wave up.
Visual
Sinusoidal graph. Phase shift and other wave properties appear in the result panel.
Shifted Unshifted
Output
Phase shift
—
—
Amplitude
—
Period
—
Vertical shift

How to use the calculator

The calculator has two modes. Simple is the default. It analyzes an existing function. Advanced builds an equation. The Wave selector (Sine or Cosine) and the vertical shift field are shared by both modes.

Simple mode: find amplitude, period, and phase shift from an equation

  1. Choose Sine or Cosine.
  2. Enter the coefficients AA, BB, CC, and DD from y=Asin⁡(Bx+C)+Dy = A\sin(Bx + C) + D or y=Acos⁡(Bx+C)+Dy = A\cos(Bx + C) + D.
  3. Read the main result, the signed Phase shift, which is labelled (left), (right), or (no shift). The cards below it show Amplitude, Period, and Vertical shift.

The starting values are sine with A=2A = 2, B=2B = 2, C=2C = 2, D=1D = 1. The Examples selector loads two presets, and editing any field returns it to Custom.

Advanced mode: write an equation from amplitude, period, and phase shift

  1. Choose Sine or Cosine.
  2. Enter a positive amplitude, a positive period, a signed phase shift (horizontal shift), and a vertical shift.
  3. Read the generated equation, which is the main result.

With the untouched defaults, Advanced displays y=2sin⁡(2π4(x−1))+1y = 2\sin\left(\frac{2\pi}{4}(x - 1)\right) + 1.

Both modes use radians. The tool has no degree mode.

Phase shift formula for sine and cosine

A sinusoid written as y=Asin⁡(Bx+C)+Dy = A\sin(Bx + C) + D can be factored as

y=Asin⁡(B(x−h))+D,h=−CB.y = A\sin\bigl(B(x - h)\bigr) + D, \qquad h = -\frac{C}{B}.

The same factoring applies to cosine. Because Bx+C=B(x−h)Bx + C = B(x - h) expands to Bx−BhBx - Bh, matching terms gives C=−BhC = -Bh, and therefore

h=−CB.h = -\frac{C}{B}.

This is the phase shift formula the calculator applies. The value hh is measured in the same units as xx.

Quantity Formula Meaning
Phase shift (horizontal shift) h=−CBh = -\dfrac{C}{B} Signed displacement along xx
Amplitude ∣A∣\lvert A \rvert Distance from the midline to a peak or trough
Period T=2π∣B∣T = \dfrac{2\pi}{\lvert B \rvert} Horizontal length of one cycle
Vertical shift DD The midline is y=Dy = D

The direction follows the sign of hh:

  • h>0h > 0: the curve shifts right.
  • h<0h < 0: the curve shifts left.
  • h=0h = 0: there is no shift.

The shift is measured relative to a reference wave with the same function, the same signed AA, the same signed BB, and the same DD, but with C=0C = 0. That reference is the dashed curve on the graph.

Phase shift versus the angle offset CC

Textbooks differ on terminology. Some call CC the phase and −C/B-C/B the phase shift. Others call CC itself the phase shift. This calculator reports the horizontal displacement −C/B-C/B, in units of xx. The constant CC is an angle in radians. At B=1B = 1, the horizontal shift is −C-C.

A common mistake is to read the sign off CC directly. For y=sin⁡(x+π3)y = \sin(x + \tfrac{\pi}{3}), CC is positive, but the curve moves left by π3\tfrac{\pi}{3}, because h=−π3h = -\tfrac{\pi}{3}. The calculator removes this ambiguity by showing the signed hh and the direction label.

Worked examples

Reading a shift from coefficients

Take y=2sin⁡(2x+2)+1y = 2\sin(2x + 2) + 1. Then A=2A = 2, B=2B = 2, C=2C = 2, and D=1D = 1.

  • Phase shift: h=−22=−1h = -\dfrac{2}{2} = -1, so the curve moves 1 unit left.
  • Amplitude: ∣2∣=2\lvert 2 \rvert = 2.
  • Period: T=2π2=π≈3.141593T = \dfrac{2\pi}{2} = \pi \approx 3.141593.
  • Vertical shift: 11.

This matches the Sine shifted left preset, which displays −1 (left), amplitude 2, period 3.141593, and vertical shift 1.

A reflected cosine with negative BB

Take y=−2cos⁡(−2x+2)+1y = -2\cos(-2x + 2) + 1. Here A=−2A = -2, B=−2B = -2, C=2C = 2, and D=1D = 1.

h=−2−2=1h = -\frac{2}{-2} = 1

The shift is +1+1, so the curve moves right. The amplitude is still ∣−2∣=2\lvert -2 \rvert = 2, and the period is 2π∣−2∣=π\dfrac{2\pi}{\lvert -2 \rvert} = \pi. This is the Reflected cosine shifted right preset, which displays 1 (right).

Two points about signs matter here:

  • A negative AA reflects the wave across its midline. The amplitude remains ∣A∣\lvert A \rvert.
  • The sign of BB is kept in the formula h=−C/Bh = -C/B and in the plotted function. Only ∣B∣\lvert B \rvert affects the period.

Starting from a factored equation

If an equation is already written as y=Asin⁡(B(x−h))+Dy = A\sin\bigl(B(x - h)\bigr) + D, the shift is visible directly as hh, but the calculator needs CC. Expand: C=−BhC = -Bh.

For y=3cos⁡(π3(x+2))y = 3\cos\left(\tfrac{\pi}{3}(x + 2)\right), we have h=−2h = -2 and B=π3B = \tfrac{\pi}{3}, so

C=−Bh=−π3⋅(−2)=2π3.C = -Bh = -\frac{\pi}{3}\cdot(-2) = \frac{2\pi}{3}.

In Simple mode, choose Cosine and enter 3 for AA, pi/3 for BB, 2π/3 for CC, and 0 for DD. The result is a phase shift of −2-2 (left), amplitude 33, and period 2ππ/3=6\dfrac{2\pi}{\pi/3} = 6.

Building an equation from properties

Suppose you need a cosine with amplitude 33, period 66, horizontal shift −2-2, and vertical shift 00. In Advanced mode, the equation is built as

y=Mcos⁡(2πT(x−h))+D=3cos⁡(2π6(x+2)).y = M\cos\left(\frac{2\pi}{T}(x - h)\right) + D = 3\cos\left(\frac{2\pi}{6}(x + 2)\right).

Because hh is negative, the display shows addition inside the parentheses. A zero vertical term is omitted, and when h=0h = 0 the argument uses xx alone. The coefficient of xx is always positive and equals 2π/T2\pi/T.

Multiple sinusoidal representations can describe the same curve. Advanced mode constructs one valid equation in this convention, but it is not the only correct answer. For example, 3sin⁡(θ+π2)=3cos⁡θ3\sin(\theta + \tfrac{\pi}{2}) = 3\cos\theta.

For the Advanced defaults (M=2M = 2, T=4T = 4, h=1h = 1, D=1D = 1), the generated equation is y=2sin⁡(π2(x−1))+1y = 2\sin\left(\tfrac{\pi}{2}(x - 1)\right) + 1. In Simple coefficients, that is A=2A = 2, B=π2B = \tfrac{\pi}{2}, C=−π2C = -\tfrac{\pi}{2}, D=1D = 1.

Reading the graph

The graph draws the shifted curve as a solid line and the unshifted reference as a dashed line. The axes are labelled, and the graph reports the period, amplitude, and graphed shift. You can zoom, pan, and reset the viewport.

A marker shows where the reference point at x=0x = 0 lands after applying the graphed shift:

  • Sine: the marked point lies on the midline y=Dy = D.
  • Cosine: the marked point is a peak when A>0A > 0 and a trough when A<0A < 0.

In the reflected cosine example, the reference value at x=0x = 0 is −2cos⁡(0)+1=−1-2\cos(0) + 1 = -1, a trough. The shifted curve reaches −2cos⁡(0)+1=−1-2\cos(0) + 1 = -1 at x=1x = 1, so the marker sits on a trough one unit to the right.

Large shifts and the graphed shift

Shifting by a whole number of periods gives the same curve. To keep the comparison readable, the graph uses the signed remainder after removing whole periods:

hgraph=h−T⋅trunc⁡ ⁣(hT).h_{\text{graph}} = h - T\cdot\operatorname{trunc}\!\left(\frac{h}{T}\right).

When ∣h∣≥T\lvert h \rvert \ge T, the tool shows an advisory explaining the equivalent graphed shift. For example, B=2B = 2, C=−13C = -13 gives h=6.5h = 6.5 and T=πT = \pi. Since trunc⁡(6.5/π)=2\operatorname{trunc}(6.5/\pi) = 2, the graphed shift is 6.5−2π≈0.2168156.5 - 2\pi \approx 0.216815. At an exact integer number of periods, the curves coincide and the graphed shift is zero.

The phase shift result in Simple mode and the equation in Advanced mode always keep the full signed shift. Only the drawing is reduced.

Input rules and limits

Fields are text-entry boxes. Numeric fields accept signed decimals, scientific notation, fractions such as 1/2, and signed multiples of π\pi, optionally divided by a decimal, such as pi/4, −pi, 2π/3, or 2*pi. An entry can be at most 100 characters. A single field does not evaluate sums, parentheses, or general expressions, so enter pi/4, not pi/2 - pi/4.

Mode Field Default Accepted values
Both Vertical shift DD 1 −10,000-10{,}000 to 10,00010{,}000
Simple AA 2 −10,000-10{,}000 to 10,00010{,}000, but not zero
Simple BB 2 −10,000-10{,}000 to −0.01-0.01, or 0.010.01 to 10,00010{,}000
Simple CC 2 −10,000-10{,}000 to 10,00010{,}000
Advanced Amplitude 2 0.010.01 to 10,00010{,}000
Advanced Period 4 0.010.01 to 10,00010{,}000
Advanced Phase shift 1 −10,000-10{,}000 to 10,00010{,}000

Simple rejects A=0A = 0, because a constant function has no unique horizontal shift, and rejects ∣B∣<0.01\lvert B \rvert < 0.01. Only the fields active in the current mode are validated. If a nonzero shift, amplitude, or vertical shift would round to zero in double precision, the calculator shows a field-specific error.

Results show up to seven significant digits with trailing zeros removed. Invalid inputs replace the result with an em dash, clear the graph, and disable Copy and Export.

Working in degrees

The calculator uses radians only. To convert an angle offset given in degrees, multiply by π/180\pi/180. For example, 30∘=π/630^\circ = \pi/6, which you can enter as pi/6.

Copy, export, and reset

Copy places the active inputs, the displayed results, and any advisory into a text summary. Export opens the browser's print dialog, where you can save the page as a PDF. Reset restores the starting Simple sine values and the graph viewport. Everything runs locally in your browser.

What the calculator does not do

The calculator analyzes and builds single sine or cosine functions from separate coefficient fields. It does not parse a typed equation, fit a curve to data, or compare the phase of two independently supplied signals. If your function includes a tangent or a sum of waves, it falls outside this tool's scope.

Frequently asked questions

How do I find the phase shift of a sine or cosine function?

Write the function as Asin⁡(Bx+C)+DA\sin(Bx + C) + D or Acos⁡(Bx+C)+DA\cos(Bx + C) + D, then compute h=−C/Bh = -C/B. A positive hh means a shift right, and a negative hh means a shift left.

Is the horizontal shift the same as the phase shift?

In this calculator, yes. Both refer to h=−C/Bh = -C/B, the signed displacement along xx. The angle offset CC is the input used with BB to calculate that displacement.

Why does a negative BB not change the period?

The period depends on ∣B∣\lvert B \rvert through T=2π/∣B∣T = 2\pi/\lvert B \rvert. The sign of BB does affect the phase shift formula, because it enters h=−C/Bh = -C/B.

Can the shift be larger than one period?

Yes. The reported shift keeps its full value, and the graph displays an equivalent shift within one period of the reference, along with an advisory.

Does a vertical shift affect the phase shift?

No. DD moves the midline to y=Dy = D and does not enter the formula for hh.

Calculation Methodology Documented

Read the formula definitions, supported input ranges, and limitations before using this estimate.

Review Methodology
Debjeet Bhowmick
Author Debjeet Bhowmick AWS Certified Solutions Architect • Cloud & DevOps Consultant

AWS Certified Solutions Architect Professional and Senior Cloud & DevOps Consultant with over 14 years of hands-on expertise architecting resilient cloud infrastructure across AWS, GCP, and Azure. Specializes in infrastructure as code, continuous delivery automation, and telemetry across Terraform, Ansible, Docker, Kubernetes, ELK, Python, and SQL. Creator of OrangeCalc, delivering client-side high-precision computational tools.