What is the max size of localStorage values?
Currently localStorage only supports strings as values, and the objects need to be converted to JSON strings before they are stored in the localStorage. Data stored using local storage isn’t sent back to the server (unlike cookies, ). All the data stays on the client-side, thus there is a defined limitation regarding the length of the values, and we can currently store from 2 MB to 10 MB size of data depending upon the browser we use.
localStorage.setItem ( 'abc', 10 ); // this integer 10 gets converted to a string "10" // and then stored in localStorage variable named "abc".
This code is to calculate the size of localStorage variable.
localStorage limit in your Browser is 5000 KBs.