Filling column with consecutive numbers in QGIS?

Just put $rownum (QGIS 2) or @row_number (QGIS 3+) as the expression. Simple as that. :)

An up-to-date list of all the field calculator functions can be read in the official docs.


@ArMoraer has developped an interesting plugin to be able to control the way this automatic numbering is made, it's named "Sort and Number". You can use it to fill a column with unique numbers by taking into account 3 other fields to sort your data like you want before numbering.

See the source topic : Is there a way to assign row number for sorted table by column in QGIS?


If you are using QGIS 3 you must used @row_number

enter image description here