Dense Layer Parameters Calculator
Calculate the number of weights and biases in a fully connected dense layer.
About Dense Layer Parameters Calculator
A dense (fully connected) layer has input_size × output_size weights plus output_size biases. This is the fundamental building block of neural networks, connecting every input neuron to every output neuron.
Formula
Dense Layer
params = input_size × output_size + output_size (if bias)
- input_size
- Number of input features
- output_size
- Number of output neurons
Worked example
With the default values below, Dense Layer Parameters Calculator returns Total Parameters of 393,728. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Input Sizeminimum 1
- 768
- Output Sizeminimum 1
- 512
- Include Biasone of Yes, No
- Yes
Results
- Total Parameters
- 393,728
- Weight Parameters
- 393,216
- Bias Parameters
- 512
Step by step
- 1Weights: input × output= 393,216
- 2Biases= 512
- 3Total parameters= 393,728
Assumptions and limits
- The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Why are dense layers expensive?
Parameters grow quadratically (O(n²)) with layer width. A 4096→4096 dense layer has 16.7M parameters, which is why transformers use attention (O(n×d)) instead of fully connected layers for sequence modeling.
When should I omit bias?
Bias is often omitted before batch normalization (which has its own bias term) or in certain architectural choices like transformer attention projections.
Related Calculators
You might also need
- CNN Parameter Count CalculatorCommonly used together
- Trainable Parameters CalculatorCommonly used together
- Parameter Count CalculatorCommonly used together
- Multi-head Attention Parameters CalculatorAlso in Neural Networks
- GRU Parameters CalculatorAlso in Neural Networks
- RNN Parameters CalculatorAlso in Neural Networks
