Get Serial Number of Raspberry Pi

Get Serial Number of Raspberry Pi

Every Raspberry Pi has a unique serial number. It is assigned during manufacturing. Serial number is a 32-bit number represented by 16 hexadecimal digits (e.g. 100000007184bc7e).

This tutorial shows how to get serial number of Raspberry Pi.

1. serial-number file

The /sys/firmware/devicetree/base/serial-number file contains the serial number of the Raspberry Pi. Use the following command to print it:

cat /sys/firmware/devicetree/base/serial-number

Example output:


2. /proc/cpuinfo file

The /proc/cpuinfo file contains information about the CPUs. It can be used to determine serial number of Raspberry Pi.

cat /proc/cpuinfo

Example of a part of the output:

processor       : 0
model name      : ARMv7 Processor rev 3 (v7l)
BogoMIPS        : 108.00

Hardware        : BCM2711
Revision        : d03114
Serial          : 100000007184bc7e
Model           : Raspberry Pi 4 Model B Rev 1.4

Command to get only serial number:

cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2

The 4 Comments Found

  1. Avatar
    AmirHosein Reply

    Hi .
    Is there any way to hack this serial number and change it ?
    I want to use it for protecting my application .

    • Avatar
      lindevs Reply

      Serial number is not a safe way to identify Raspberry Pi. I recommend to use other identification technique.

      • Avatar
        Joey Reply

        Can you explain why it is not safe? Especially when he changes it noone could possibly figure it out unless they have the physical device right? What other methods would you recommend?

      • Avatar
        lindevs Reply

        For example, the /proc/cpuinfo file can be copied, and the serial number can be changed. Then, remount the fake file over the original. Maybe use a combination of multiple information such as serial number, revision code, MAC address, etc. I suggest you to identify security risks in the system and perform research of device identification techniques.

Leave a Comment

Cancel reply

Your email address will not be published.