Technology

Shannon Entropy (two outcomes)

H = -p log₂ p - (1-p) log₂(1-p). Free online Shannon Entropy (two outcomes) for technology — instant, accurate results, mobile-friendly, no signup needed.

Entropy (bits)
1

Derivation

  1. ├── 01Givenp = 0.5
  2. ├── 02Formula{let t=e.p;return-(t × log₂(t)+(1-t) × log₂(1-t))}
  3. ├── 03Substitute{let t=e.0.5;return-(t × log₂(t)+(1-t) × log₂(1-t))}
  4. └── 04Compute Entropy (bits)1
Did you know?

Every calculator here runs 100% in your browser — nothing is sent to a server or stored in a database.

§01What is

Understanding the Shannon Entropy (two outcomes)

The Shannon Entropy (two outcomes) computes Entropy (bits) from 1 input: p(a). H = -p log₂ p - (1-p) log₂(1-p).

Quick calculators for the math that shouldn’t need a notepad — instant, accurate, private to your browser. The Shannon Entropy (two outcomes) sits in that toolkit — it H = -p log₂ p - (1-p) log₂(1-p). Enter your numbers above and the result updates instantly; every step of the math is shown in the Derivation panel so you can see exactly how the answer was reached.

§02The Formula

How it’s calculated

{let t=e.p;return-(t × log₂(t)+(1-t) × log₂(1-t))}

Where

p
P(A)
§03Practical Example

Step-by-step walkthrough

Scenario

Apply the formula to a realistic set of inputs: P(A) = 0.5.

  1. 01Start by noting the input — P(A): 0.5.
  2. 02Substitute these values into the formula: {let t=e.p;return-(t × log₂(t)+(1-t) × log₂(1-t))}
  3. 03Compute Entropy (bits): the calculator returns 1.
  4. 04Cross-check the answer by opening the Derivation panel above — every line of math is shown so you can follow the computation end-to-end.
§04Variants

Common Shannon Entropy (two outcomes) Problems

The formula gets rearranged depending on which variable you need. Here are the patterns you’ll run into in the real world — find the one that matches your problem and follow the worked steps.

01 · PATTERN

P(A) halved

p = 0.25 (from 0.5)

Keep every other input at its default and halve the p(a). See how entropy (bits) responds.

  1. 01New P(A): 0.25
  2. 02Baseline Entropy (bits): 1
  3. 03New Entropy (bits): 0.811278
  4. 04Entropy (bits) decreases by 18.9% → use this sensitivity to plan for real-world variation.
§05FAQ

Frequently asked questions

Yes. The calculator implements the standard formula as documented and returns exact floating-point results. No approximations are used unless noted in the formula.
Your feedback

How useful was this calculator?

Your ratings stay in your browser — they help us learn which tools people actually rely on.

Rate it
Was this helpful?