Parameter Count Calculator
Calculate the number of trainable parameters in a dense, convolutional, or LSTM layer.
Inputs
Input features (dense) or input channels (Conv2D/LSTM input dim).
Output units (dense), output channels (Conv2D), or hidden size (LSTM).
Only used for Conv2D layers (assumes a square kernel).
Total Parameters
131,328
Weight Parameters
131,072
Bias Parameters
256
Step by step
Dense: (input × output) + output (bias)
(512 × 256) + 256
= 131,328
Weight parameters vs. bias parameters
131,072 (weights) + 256 (biases)
= 131,328
How it works
Parameter count varies by layer type. A dense (fully connected) layer has params = input × output + output, where the extra output term is the bias vector. A Conv2D layer has params = kernel_h × kernel_w × in_channels × out_channels + out_channels, since the same kernel is shared across all spatial positions. An LSTM layer has four gates (input, forget, output, cell), each acting like a dense layer over the concatenated input and hidden state, giving params = 4 × [hidden × (input + hidden)] + 4 × hidden.
Formulas
Dense layer
params = input_size * output_size + output_size
- input_size
- Number of input features
- output_size
- Number of output units (neurons)
Conv2D layer
params = kernel_h * kernel_w * in_channels * out_channels + out_channels
- kernel_h
- Kernel height
- kernel_w
- Kernel width
- in_channels
- Input channels
- out_channels
- Output channels (filters)
LSTM layer
params = 4 * (hidden * (input + hidden)) + 4 * hidden
- input
- Input dimension
- hidden
- Hidden state dimension
Frequently Asked Questions
Why does Conv2D have far fewer parameters than Dense for the same input/output size?
Convolutional layers share the same small kernel across every spatial location, so the parameter count depends only on kernel size and channel counts, not on the spatial dimensions of the input.
Why does LSTM have 4x more parameters than a similarly-sized dense layer?
An LSTM cell contains four internal gates (input, forget, output, and cell/candidate), each with its own weight matrix and bias, so its parameter count is roughly four times that of one dense transformation of the same size.
Does this include normalization layer parameters?
No, this calculates only the specified layer type. BatchNorm/LayerNorm add a small number of additional parameters (typically 2 × channels) not included here.
How do I estimate a full model's parameter count?
Sum the parameter counts of every layer in the architecture. For transformer models specifically, see the Transformer Parameters Calculator for a purpose-built formula.
You might also need
- RNN Parameters CalculatorCommonly used together
- GRU Parameters CalculatorCommonly used together
- LSTM Parameters CalculatorCommonly used together
- Trainable Parameters CalculatorCommonly used together
- Embedding Layer Size CalculatorCommonly used together
- Transformer Parameters CalculatorCommonly used together