Roboculator
Online CalculatorsCategoriesDate & EventsNews
Get Started
Online CalculatorsCategoriesDate & EventsNewsGet Started
Roboculator

Smart calculators for every challenge. Free, fast, and private.

Categories

  • Finance
  • Health
  • Math
  • Construction
  • Conversion
  • Everyday Life

Popular Tools

  • Date & Events
  • Loan Calculator
  • BMI Calculator
  • Percentage Calc
  • Latest News
  • Search All

Resources

  • Glossary
  • Topic Tags
  • News & Insights

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  • Editorial Policy
  • Disclaimer
© 2026 Roboculator. All rights reserved.
Roboculator

roboculator.com

  1. Home
  2. /Math
  3. /Trigonometry Calculators
  4. /Hyperbolic Tangent Calculator

Hyperbolic Tangent Calculator

Last updated: March 15, 2026

Calculator

Results

tanh(x)

0.76159416

sinh(x)

1.17520119

cosh(x)

1.54308063

sech(x)

0.64805427

Results

tanh(x)

0.76159416

sinh(x)

1.17520119

cosh(x)

1.54308063

sech(x)

0.64805427

In This Guide

  1. 01Key Properties
  2. 02Relationship to the Logistic Sigmoid
  3. 03The tanh in Neural Networks
  4. 04Applications

The Hyperbolic Tangent Calculator computes $$\tanh(x)$$ for any real number $$x$$. The hyperbolic tangent is defined as the ratio of hyperbolic sine to hyperbolic cosine and is one of the most important activation functions in modern machine learning and neural networks.

The hyperbolic tangent is defined as:

$$\tanh(x) = \frac{\sinh(x)}{\cosh(x)} = \frac{e^x - e^{-x}}{e^x + e^{-x}}$$

This function maps any real number to a value strictly between -1 and 1, producing a smooth, S-shaped (sigmoid-like) curve that passes through the origin. It smoothly saturates to $$\pm 1$$ as $$x \to \pm\infty$$.

Key Properties

  • Domain: All real numbers $$(-\infty, +\infty)$$
  • Range: $$(-1, 1)$$ — strictly between -1 and 1
  • Symmetry: $$\tanh(-x) = -\tanh(x)$$ (odd function, zero-centered)
  • At zero: $$\tanh(0) = 0$$
  • Limits: $$\lim_{x \to +\infty} \tanh(x) = 1$$, $$\lim_{x \to -\infty} \tanh(x) = -1$$
  • Derivative: $$\frac{d}{dx}\tanh(x) = 1 - \tanh^2(x) = \text{sech}^2(x)$$
  • Taylor series: $$\tanh(x) = x - \frac{x^3}{3} + \frac{2x^5}{15} - \frac{17x^7}{315} + \cdots$$

Relationship to the Logistic Sigmoid

The hyperbolic tangent is closely related to the logistic sigmoid function $$\sigma(x) = \frac{1}{1 + e^{-x}}$$:

$$\tanh(x) = 2\sigma(2x) - 1$$

Both functions are sigmoid-shaped, but $$\tanh$$ is zero-centered (output range $$(-1,1)$$) while the logistic sigmoid maps to $$(0,1)$$. This zero-centered property often makes $$\tanh$$ preferable as an activation function in neural networks, since it helps keep the mean of activations near zero.

The tanh in Neural Networks

In deep learning, $$\tanh$$ was historically one of the most popular activation functions before ReLU became dominant. Its advantages include:

  • Zero-centered output, which can speed up convergence
  • Smooth and differentiable everywhere
  • Bounded output prevents exploding activations

However, tanh suffers from the vanishing gradient problem: for large $$|x|$$, the derivative $$1 - \tanh^2(x)$$ approaches zero, making gradient-based learning extremely slow in deep networks.

Applications

Beyond machine learning, $$\tanh$$ appears in many scientific contexts. In special relativity, the velocity addition formula for collinear velocities uses $$\tanh$$: if rapidities add as $$\phi = \phi_1 + \phi_2$$, then $$v/c = \tanh(\phi)$$. In fluid dynamics, $$\tanh$$ profiles describe shear layers and mixing zones. In magnetism, the Brillouin function (which describes paramagnetic magnetization) reduces to $$\tanh$$ for spin-1/2 particles. In electrical engineering, $$\tanh$$ appears in impedance matching and transmission line calculations. The function also models dose-response curves in pharmacology and population saturation in ecology.

Visual Analysis

How It Works

Enter any real number $$x$$. The calculator computes $$\tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}}$$ and also displays the underlying $$\sinh(x)$$ and $$\cosh(x)$$ values.

Understanding Your Results

The result is always between -1 and 1. Values near 0 indicate the input is small; values near $$\pm 1$$ indicate the input is large in magnitude. The function transitions most steeply around $$x = 0$$, where the derivative equals 1. For $$|x| > 3$$, tanh is nearly saturated at $$\pm 1$$.

Worked Examples

Computing tanh(0)

Inputs

x0

Results

tanh val0
sinh val0
cosh val1

tanh(0) = sinh(0)/cosh(0) = 0/1 = 0. The function passes through the origin.

Computing tanh(2)

Inputs

x2

Results

tanh val0.964028
sinh val3.62686
cosh val3.762196

tanh(2) ≈ 0.964, already close to the asymptotic limit of 1, showing rapid saturation.

Frequently Asked Questions

The $$\tanh$$ function is zero-centered (outputs range from -1 to 1), smooth, and differentiable. Zero-centering helps optimization by keeping layer outputs balanced. However, it suffers from vanishing gradients for large inputs, which is why ReLU and its variants are now more common in deep networks.

For large $$|x|$$, $$\tanh(x)$$ saturates near $$\pm 1$$ and its derivative $$1 - \tanh^2(x)$$ approaches 0. During backpropagation, these near-zero gradients multiply across layers, causing weights in early layers to update extremely slowly or not at all.

$$\tanh(x) = 2\sigma(2x) - 1$$, where $$\sigma$$ is the logistic sigmoid. Equivalently, $$\sigma(x) = \frac{\tanh(x/2) + 1}{2}$$. The tanh maps to $$(-1, 1)$$ while the sigmoid maps to $$(0, 1)$$.

No. The function approaches these values asymptotically but never reaches them. For any finite $$x$$, $$|\tanh(x)| < 1$$. Only in the limit as $$x \to \pm\infty$$ does the value reach $$\pm 1$$.

The inverse hyperbolic tangent is $$\text{arctanh}(x) = \frac{1}{2}\ln\left(\frac{1+x}{1-x}\right)$$ for $$|x| < 1$$. It maps the interval $$(-1, 1)$$ back to all real numbers.

In special relativity, velocity as a fraction of light speed is $$v/c = \tanh(\phi)$$ where $$\phi$$ is the rapidity. In magnetism, the magnetization of spin-1/2 particles follows $$M = M_s \tanh\left(\frac{\mu B}{k_B T}\right)$$. It also models shear layers in fluid dynamics and soliton solutions of the KdV equation.

Sources & Methodology

Abramowitz, M. & Stegun, I.A. (1972). Handbook of Mathematical Functions. Dover Publications. | Goodfellow, I., Bengio, Y., & Courville, A. (2016). Deep Learning. MIT Press. | Weisstein, E.W. "Hyperbolic Tangent." MathWorld — A Wolfram Web Resource.
R

Roboculator Team

The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.

How helpful was this calculator?

Be the first to rate!

Related Calculators

Cofunction Calculator

Trigonometry Calculators

Double Angle Calculator

Trigonometry Calculators

Half Angle Calculator

Trigonometry Calculators

Unit Circle Calculator

Trigonometry Calculators

Reference Angle Calculator

Trigonometry Calculators

Coterminal Angle Calculator

Trigonometry Calculators