Sigmoid Calculator

Sigmoid Calculator σ(x) = 1 / (1 + e−x)

Enter a single number x to get the sigmoid (logistic) value, its derivative, and a live plot of the S-curve with your point marked. Great for logistic regression, binary classification and understanding activation functions.

Examples:

This free sigmoid calculator evaluates the logistic function σ(x) = 1 / (1 + e−x) for any number you enter, shows its derivative, and draws the classic S-curve with your point marked. Type a value above, press Compute, and you see the exact output, the working, and where it sits on the curve — the same function that turns a raw score into a probability in logistic regression and neural networks.

What is the sigmoid (logistic) function?

The sigmoid function, also called the logistic function, is a smooth, S-shaped curve that squashes any real number into the open interval between 0 and 1. Its formula is deceptively simple: σ(x) = 1 / (1 + e−x), where e is Euler’s number (about 2.71828). No matter how large or small x becomes, the result never quite reaches 0 or 1 — it only approaches them. That bounded output is exactly why the sigmoid became the workhorse for converting an unbounded score into something you can read as a probability.

Because the output always lands between 0 and 1, a sigmoid value of 0.5 sits right in the middle and corresponds to an input of exactly zero. Positive inputs push the output above 0.5 (toward 1); negative inputs pull it below 0.5 (toward 0). This calculator makes that relationship visible: the horizontal dashed line at y = 0.5 crosses the curve precisely where x = 0, and your point slides along the S as you change the input.

How to use the sigmoid calculator

  1. Enter a single number in the Input value x box — it can be positive, negative, a decimal, anything.
  2. Press Compute σ(x), or just keep typing: the tool recomputes live as you edit the value.
  3. Read the highlighted tile for σ(x), the neighbouring tile for the derivative σ′(x), and the interpretation tile for a plain-English, probability-style reading.
  4. Look at the plot: the indigo S-curve is the sigmoid across x in [−8, 8], and the purple dot with dashed guide lines marks your exact point.
  5. Open Show the working to follow the substitution and the derivative step by step, and use Decimal places or Copy result as needed.

Try the preset chips — Zero, Positive, Large and Negative — to build intuition quickly for how the output saturates near the extremes.

The formula and the shape of the S-curve

The defining equation is:

σ(x) = 1 / (1 + e−x)

A few properties fall straight out of this formula and are worth committing to memory:

  • Range 0 to 1. The output is always strictly between 0 and 1. It is never negative and never exceeds 1, which is what makes it interpretable as a probability.
  • Midpoint at x = 0. Substituting x = 0 gives σ(0) = 1 / (1 + 1) = 0.5. The curve passes through the point (0, 0.5).
  • Symmetry. The sigmoid has rotational symmetry about (0, 0.5): σ(−x) = 1 − σ(x). So σ(−2) and σ(2) add up to exactly 1.
  • Saturation. For large positive x the output flattens toward 1; for large negative x it flattens toward 0. Beyond roughly x = ±6 the curve is nearly flat — the sigmoid has “saturated”.
  • Monotonic. It is always increasing: a larger input never produces a smaller output.

Worked example

Suppose your model produces a raw score of x = 2 and you want the corresponding probability. Plug it into the formula:

σ(2) = 1 / (1 + e−2) = 1 / (1 + 0.13534) = 1 / 1.13534 = 0.8808.

So a score of 2 maps to about 0.88, or an 88% probability of the positive class. By symmetry, a score of −2 maps to 1 − 0.8808 = 0.1192, about 12%. Enter both values above to confirm — the calculator returns 0.8808 and 0.1192, and the curve shows how far apart those two points sit even though the inputs are the same distance from zero.

The derivative and vanishing gradients

Training a model means adjusting parameters using gradients, so the derivative of the sigmoid matters as much as the function itself. It has a famously clean form:

σ′(x) = σ(x) · (1 − σ(x))

This is elegant because once you have computed σ(x), the derivative costs almost nothing — just multiply the output by one minus itself. The derivative is largest at x = 0, where σ(0) = 0.5 and σ′(0) = 0.5 × 0.5 = 0.25, its maximum value. As the input moves away from zero and the curve saturates, the derivative shrinks rapidly toward zero.

That shrinking is the root of the vanishing gradient problem. In a deep network, gradients are multiplied together layer by layer during backpropagation. Because the sigmoid’s derivative never exceeds 0.25 and is tiny in the saturated regions, stacking many sigmoid layers multiplies many small numbers together, and the gradient reaching the early layers becomes vanishingly small — so those layers barely learn. This is a big reason modern deep networks favour ReLU and its variants for hidden layers, reserving the sigmoid mainly for the output of binary classifiers.

Sigmoid in Python with NumPy

In code, the sigmoid is a one-liner that works element-wise on whole arrays:

import numpy as np
def sigmoid(x):
    return 1 / (1 + np.exp(-x))

print(sigmoid(0))   # 0.5
print(sigmoid(2))   # 0.8807970779778823

# derivative, given the output s:
s = sigmoid(2)
print(s * (1 - s)) # 0.104993...

For numerical stability with very large negative inputs, production code sometimes uses a piecewise version to avoid computing exp of a large positive number, but the plain formula above is exactly what this calculator evaluates and is fine for ordinary ranges.

Where the sigmoid shows up in machine learning

The sigmoid is everywhere a bounded, probability-like output is needed:

  • Logistic regression. The model computes a linear score and passes it through the sigmoid to produce the probability of the positive class — the sigmoid is what makes “logistic” regression logistic.
  • Binary classification. The final neuron of a binary classifier uses a sigmoid so the network outputs a single probability; you then threshold at 0.5 (or another cutoff) to decide the class.
  • Gates in RNNs. LSTM and GRU cells use sigmoids as gates — values near 0 close the gate and values near 1 open it — to control how information flows through time.
  • Attention and masking. Anywhere a soft on/off switch between 0 and 1 is useful, the sigmoid provides a differentiable stand-in for a hard yes/no.

For multi-class problems where the outputs must sum to 1, the generalisation you want is the softmax function rather than independent sigmoids.

Common mistakes to avoid
Treating the sigmoid output as a hard class label instead of a probability; forgetting the minus sign in e−x; using sigmoids in every hidden layer of a deep network and then wondering why it will not train (vanishing gradients); and confusing the sigmoid with softmax — sigmoid handles one output at a time, softmax normalises a whole vector so it sums to 1.

Frequently asked questions

What is σ(0)?

Exactly 0.5. Substituting x = 0 gives 1 / (1 + e0) = 1 / (1 + 1) = 0.5, so the curve passes through (0, 0.5).

What is the range of the sigmoid function?

The output is always strictly between 0 and 1. It approaches 0 for large negative inputs and 1 for large positive inputs but never actually reaches either bound.

What is the derivative of the sigmoid?

It is σ′(x) = σ(x)(1 − σ(x)). Its maximum value is 0.25 at x = 0, and it shrinks toward zero as the input grows in magnitude — which is what causes vanishing gradients.

What is the difference between sigmoid and softmax?

Sigmoid maps a single number to a value in (0, 1) independently. Softmax takes a vector and produces a set of values that are each in (0, 1) and sum to 1, making it the choice for mutually exclusive multi-class classification.

Why is the sigmoid used less in hidden layers now?

Because its derivative is small (at most 0.25) and near zero in the saturated regions, deep stacks of sigmoids suffer from vanishing gradients. ReLU and its variants keep gradients larger, so they train deep networks more reliably; the sigmoid is now used mainly at the output of binary classifiers.

Related calculators

Turn a whole vector of scores into probabilities with the softmax calculator, fit a straight line to data with the linear regression calculator, or explore the full linear algebra calculators hub.