Google Sheets TANH Function: Syntax, Examples & Tips

Returns the hyperbolic tangent of any real number.
Google Sheets
=TANH(value)

One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.

On this page
  1. Parameters
  2. What Is TANH?
  3. Key Properties
  4. Basic Examples
  5. Practical Uses
  6. Common Use Cases
  7. Common Errors
  8. Tips and Best Practices
  9. Related Functions
  10. Example use case

Parameters

ParameterRequiredDescription
valueYesAny real number to calculate the hyperbolic tangent of. Unlike TAN, this is not an angle.

What Is TANH?

TANH returns the hyperbolic tangent of a number. It is defined as

TANH(x) = SINH(x) / COSH(x) = (e^x − e^−x) / (e^x + e^−x)

Despite the similar name, TANH is not a trigonometric function of an angle — it belongs to the hyperbolic family (SINH, COSH, TANH), which is built from the exponential function. There is no need to convert to radians.

Key Properties

  • Output range: the result is always strictly between −1 and 1.
  • Zero in, zero out: TANH(0) is 0.
  • Odd function: TANH(-x) = -TANH(x).
  • Saturation: as x gets large, TANH approaches 1; as x gets very negative, it approaches −1. Around |x| > 20 the result rounds to exactly ±1 in Sheets.
  • Near zero it is almost linear: for small x, TANH(x) ≈ x.

This S-shaped curve is what makes TANH useful — it squashes any input into a bounded range while preserving the sign and ordering.

Basic Examples

Hyperbolic tangent of a number

Google Sheets
=TANH(1)

Returns approximately 0.7616.

Large values saturate

Google Sheets
=TANH(5)

Returns approximately 0.9999.

Negative input

Google Sheets
=TANH(-0.5)

Returns approximately −0.4621.

Apply to a column

Google Sheets
=ARRAYFORMULA(TANH(B2:B100))

Practical Uses

Squashing scores into a bounded range

If you have unbounded scores (for example, net sentiment or z-scores) and want them between −1 and 1 without hard clipping, TANH gives a smooth result:

Google Sheets
=TANH(B2 / 10)

Dividing by a scale factor controls how quickly values saturate.

Neural network activations

TANH is a classic activation function. If you are prototyping a tiny model or teaching how one works in a spreadsheet, you can compute a neuron's output with:

Google Sheets
=TANH(SUMPRODUCT(B2:D2, $B$10:$D$10) + $E$10)

Inverse: ATANH

To reverse the operation, use ATANH, which accepts values strictly between −1 and 1:

Google Sheets
=ATANH(TANH(0.8))

returns 0.8. ATANH is also the Fisher transformation used to normalise correlation coefficients: =ATANH(CORREL(A2:A50, B2:B50)).

Converting to a 0–1 scale

The logistic (sigmoid) function is closely related: (TANH(x/2) + 1) / 2 equals 1 / (1 + EXP(-x)).

Common Use Cases

  • Data science and ML teaching: Activation functions.
  • Statistics: Back-transforming Fisher z values (=TANH(z) returns a correlation).
  • Physics: Velocity of falling objects with drag, magnetisation models.
  • Score normalisation: Soft-capping outliers.

Common Errors

  • Confusing TANH with TAN: TAN works on angles in radians and has asymptotes; TANH works on any number and is bounded. They give very different results.
  • #VALUE!: The input is text that isn't numeric.
  • ATANH of ±1: When reversing, ATANH(1) and ATANH(−1) return #NUM! because the result would be infinite.

Tips and Best Practices

  • Scale your input before applying TANH so the useful range of your data falls roughly between −3 and 3, where the curve is most responsive.
  • Round results for presentation; the raw output has many decimal places.
  • Use FISHERINV as an alternative name when back-transforming Fisher z values — it computes the same thing as TANH.

SINH, COSH, ATANH, TAN, EXP, FISHER, and FISHERINV.

Example use case

A data analyst averaging correlation coefficients across several studies converts each r to a Fisher z with =ATANH(B2), averages the z values, and converts the average back to a correlation with =TANH(D1) — a statistically sounder approach than averaging r directly.

Need more help with Google Sheets formulas?

Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.

Explore all Google Sheets formulas

Browse our complete library of Google Sheets formula guides

Compare your options

Decide with evidence, not a sales pitch.

Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.

  1. 01ChatGPTOpen a balanced comparison prompt in ChatGPT.
  2. 02ClaudeOpen the same research prompt in Claude.
  3. 03PerplexityResearch the comparison with linked web sources.

AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.