A spike travelling through a neuron, from the cable equation

Touch a branch of a neuron and watch the electrical signal spread, fade or fire, and run down the axon. The cable equation with Hodgkin and Huxley's channels, solved live in the browser.

Published
16 November 2026
Run
In the browser
Model
Cable equation, Hodgkin-Huxley channels
Stack
Rust, webassembly, webgl
Download
70 KB
Open neuron
Contents
  1. A leaky cable
  2. Channels that fire
  3. Passive and active dendrites
  4. Solved one tree at a time
  5. The shape
  6. Checked against what has to be true
  7. Small enough to just open
  8. Try it
  9. Further reading
A branching neuron on black, glowing orange where it has just fired, with the spike's white-hot front running down three axon branches
fig. 1 — a fraction of a millisecond after the cell body fires. The dendrites are still lit; the spike's front, white-hot, is partway down the axon's branches.

A neuron is a tree. Thousands of inputs land on its branching dendrites, their effects spread towards the cell body, and when the voltage there rises far enough the cell fires a spike that runs down its axon to the next cells. How a signal fares on that journey, whether it fades, adds up with others or sets off a spike of its own on the way, depends on the shape of the tree and the channels in its membrane.

Simulating that is a sixty-year-old craft. NEURON, the standard simulator, has been in use since the 1980s. Jaxley, published in Nature Methods in 2025, does the same calculation in a form that can be differentiated, so that a detailed neuron model can be fitted to recordings the way a neural network is trained. Neither runs in a web page. The app described here, neuron, solves the same equations in the browser, fast enough to watch. Open it, click a branch, and watch the signal travel.

A leaky cable

A dendrite is a thin tube of salty fluid inside a membrane that leaks. Current injected at one point flows along the inside, and some escapes through the wall as it goes. The voltage along such a tube obeys the cable equation, the same one Kelvin worked out for the transatlantic telegraph. Wilfrid Rall applied it to branching dendrites in 1959:

Cm ∂V/∂t = (a / 2Ra) ∂²V/∂x² − Iion(1)

The first term on the right is current flowing along the branch. It grows with the radius a and falls with Ra, the resistance of the fluid inside. The second is current crossing the membrane. Fine branches carry little current along their length and leak it away quickly, so a signal injected at a dendrite tip arrives at the cell body small and smeared out. Set the app’s dendritic sodium channels to zero and click a tip to see it: the voltage trace at the tip jumps, the one at the cell body barely stirs.

Channels that fire

The membrane current comes from ion channels, and Hodgkin and Huxley’s description of them, from the squid giant axon in 1952, is still the template:

Iion = ḡNa m³h (V − ENa) + ḡK n⁴ (V − EK) + gL (V − EL)(2)

Sodium channels open quickly when the voltage rises and let sodium in, which raises the voltage further. Potassium channels open more slowly and pull it back down. The gates m, h and n each open and close at rates that depend on voltage. Past about −55 mV the sodium current runs away, and the membrane fires a spike to about +40 mV and recovers within a few milliseconds. A patch that fires drives current into its neighbours and fires them too, so the spike travels without fading, and afterwards the patch cannot fire again for a few milliseconds.

Passive and active dendrites

In the app the cell body and axon have the full squid-axon channel density, and a slider sets the dendrites’ share. At zero the dendrites are passive cables. Turned up, they fire spikes of their own, so a jolt at a distant tip can reach the cell body at full strength, and a spike from the cell body also travels back up into the dendrites. Real pyramidal neurons do the second: Stuart and Sakmann recorded spikes travelling back into the dendrites of cortical cells in 1994, and how active dendrites shape what a neuron computes has been studied ever since.

Solved one tree at a time

The neuron is cut into pieces about 8 µm long, each joined to its parent by the resistance of the fluid between them. The voltages of all of them are solved together, implicitly, so the time step is set by the channels and not by the smallest piece. That needs a linear system solved every step, and for a tree it can be done in one pass from the tips in to the root and one pass back out: Michael Hines’s method from 1984, which NEURON and Jaxley both use. The gates are advanced with an exponential step, as is standard. One 25 µs step for a cell of a thousand pieces takes a few tens of microseconds, so the app runs the neuron slowed down, at a few milliseconds of its time per second of yours.

The shape

The neuron on screen is grown by a small program: a cell body, a long apical dendrite branching on its way up, a skirt of shorter basal dendrites, and a thin axon going down. That is the plan of a pyramidal cell in the cortex. Each press of A different neuron grows another. Real reconstructions, traced from microscope images and shared as SWC files on NeuroMorpho.org, can be loaded too. Branches are drawn thicker than they are, or the finest would be invisible.

Checked against what has to be true

The engine is tested for the things that would show a mistake. One step of the tree solver must match a brute-force solve of the same linear system to nine decimal places. A cell left alone must stay at its resting voltage. A spike started at the cell body must reach the far end of the axon, and later than it left. A signal injected into a passive dendrite must arrive at the cell body much smaller than it started. With the default channels, a jolt at any of the dendrite tips of three different generated neurons fires the cell body, which takes 2 to 3 ms.

Small enough to just open

The engine is about 400 lines of Rust compiled to WebAssembly, 70 KB, and the page draws the neuron as tubes in WebGL coloured by voltage. Nothing is sent anywhere, including a loaded SWC file. It is written from the published equations and shares no code with NEURON or Jaxley.

Try it

Open neuron. Press Spike at the cell body, then Jolt a dendrite tip, and watch the voltage traces. Then turn the dendrites’ sodium channels down to zero and jolt a tip again. How it works, on the page, has the details.

Further reading