# max_allowed_uids (/docs/hyperparameters/max-allowed-uids)

`max_allowed_uids` is the number of neuron slots (UIDs) a subnet has. Subnet owners size it to match how many miners and validators they actually want; participants care because a full subnet means every new registration evicts someone.

## How it works [#how-it-works]

While the neuron count is below `max_allowed_uids`, a registration simply appends a new UID (`append_neuron`). Once full, `get_neuron_to_prune` selects the lowest-emission prunable neuron and `replace_neuron` hands its slot to the entrant (`pallets/subtensor/src/subnets/registration.rs`) — see [`immunity_period`](/docs/hyperparameters/immunity-period) for who is protected.

Raising the value with `btcli sudo set` is straightforward, but lowering it below the current neuron count is rejected (`MaxAllowedUIdsLessThanCurrentUIds` in `pallets/admin-utils/src/lib.rs`); the setter also enforces the range between the subnet's minimum and the chain-wide cap of 256. To shrink an occupied subnet, use `btcli sudo trim`, which calls `trim_to_max_allowed_uids` (`pallets/subtensor/src/subnets/uids.rs`): it removes the lowest-emission neurons while preserving temporally and owner-immune UIDs, refuses to act if immune UIDs would exceed 80% of the new capacity, then compacts the surviving UIDs to the left. Trimming is heavily rate-limited (about 30 days between trims).

<HyperparamUidLifecycle focus="max_allowed_uids" />

## Reading and setting [#reading-and-setting]

```
btcli sudo get --netuid N --name max_allowed_uids
```

The value is a plain integer slot count:

```
btcli sudo set --netuid N --name max_allowed_uids --value 256
```

## Related [#related]

[`immunity_period`](/docs/hyperparameters/immunity-period), [`owner_immune_neuron_limit`](/docs/hyperparameters/owner-immune-neuron-limit), [`serving_rate_limit`](/docs/hyperparameters/serving-rate-limit), [`min_burn`](/docs/hyperparameters/min-burn), [`max_regs_per_block`](/docs/hyperparameters/max-regs-per-block)
