I was recently working on a project where I had to create a custom ID column in a SharePoint list with a specific format like yyyyMMdd-[ID]. But we can’t directly change or customize the default ID column of a SharePoint list.
After researching, I figured out a way to customize the ID column of a SharePoint list using JSON code.
In this article, I’m going to share how you can customize the ID column in a SharePoint list using JSON formatting.
Create a Custom Unique ID Column in SharePoint List
By default, the SharePoint list and library have a pre-defined ID column, which gives a unique ID to each list or library item. This column automatically increments for each item.
For example, if you add a new item to the SharePoint list, it will display the ID as ‘1‘. Similarly, for the following item, display as ‘2‘ and so on.
If you delete an item from the list, the deleted item ID won’t be assigned to the next item.

You can apply JSON formatting to create a custom ID column in a SharePoint list.
Below are the steps to create a unique ID column in a SharePoint list:
Suppose I have taken a SharePoint list named Event Registration with a couple of columns in it.
| Column Name | Column Type |
|---|---|
| Event name | Title – Renamed it to Event Name |
| Event ID | Single line of text |
| ID | Default column |
| Created | Default column |
In this list, I want to customize the Event ID in a specific format like yyyyMMdd-ID [20250404-001].

Example 1:
- Open your SharePoint list, click on the drop-down of a SharePoint column, choose Column settings ->click on Format this column.

- It will open the Format view pane; click on the Advanced mode link to insert the code.

- In the Format view, remove the text from the box and add custom JSON code.
- Paste the code given below.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=toString(getYear([$Created])) + if((getMonth([$Created]) + 1) < 10, '0' + toString(getMonth([$Created]) + 1), toString(getMonth([$Created]) + 1)) + if(getDate([$Created]) < 10, '0' + toString(getDate([$Created])), toString(getDate([$Created]))) + '-' + padStart([$ID], 3, '0')"
}- Click on the Save button to apply the changes.

- Now, create an item in the Event Registration list.

- The Event ID will be displayed automatically in a specific format [yyyyMMdd-ID], based on the created date of the list item.
- Look at the screenshot below:

Note:
In the above JSON code, you can replace the ID column with any other column, such as the Title or Text column. But the JSON does not support the Number column, as I have tested on my side.
Example 2:
You can also create a custom ID based on the Title column from a SharePoint list, according to your requirement.
In the above code, I will replace the ID with the Title column, then it will show the following output:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=toString(getYear([$Created])) + if((getMonth([$Created]) + 1) < 10, '0' + toString(getMonth([$Created]) + 1), toString(getMonth([$Created]) + 1)) + if(getDate([$Created]) < 10, '0' + toString(getDate([$Created])), toString(getDate([$Created]))) + '-' + padStart([$Title], 4, '0')"
}
This is all you need to know about creating a custom, unique ID column in a SharePoint list.
I hope you found this article interesting and helpful. Let me know about any suggestions in the comments section.
You may also like the following tutorials:
- How to Format a SharePoint Online List Column using JSON?
- SharePoint Calculated Column to Extract Email from Person Field [using JSON]
- How to Customize SharePoint Modern list form using JSON
- Gantt Chart View in SharePoint Online Modern List Using JSON
- How to Get Last & First Item ID from SharePoint List in Power Automate?
- How to Generate a Unique ID for a SharePoint List item Using Power Automate?
- How to Customize SharePoint List Form Layout using JSON Code?

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.