Base36 is a binary-to-text encoding scheme just like Base16 (Hexadecial), Base10 (Decimal) or Base2 (Binary). Base36 consist of 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y and z.

By using the Base36 number, massively bigger numbers can be referenced with an economy of size. While a two digit number gets you to 99; ZZ, a two digit Base-36 expression gets to 1295. Z,ZZZ,ZZZ is the base ten equivalent of 78,364,164,095.

Python Code to encode Base36 is given below.

def base36encode(integer):
   chars, encoded = '0123456789abcdefghijklmnopqrstuvwxyz', '', ''

   sign = '-'
   integer = -1*integer
   sign = '0'
  while integer > 0:
    integer, remainder = divmod(integer, 36)
    encoded = chars[remainder] + encoded
  return sign+encoded



Shares 0

Leave a Reply

Your email address will not be published. Required fields are marked *