So Guys You Need to remove the %20 like unknown codes. Sol: 1) I f you want to remove %20 from a text like "I%20am%20a%20Student." only then you should use var txt ="I%20am%20a%20Student." var str = txt.replace(/%20/g," ") console.log(str); Output: I am a Student. OR simply, You can use decodeURI(txt) OR decodeURIComponent(txt) OR unescape(txt) 2) I f you want to remove %20, %2E etc from a text like "Hurrah%21%20We%20have%20won%20the%20match%2E" then you should use var str ="Hurrah%21%20We%20have%20won%20the%20match%2E" unescape(txt) ** OR decodeURI(txt) OR decodeURIComponent(txt) **You Should avoid use of unescape() as it was d eprecated in JavaScript version 1.5. Thanks for reading comment here below if you liked it.