var str = "aHR0cHM6Ly9qZXN0dXIuaXRjaC5pby9yaXBwbGVzCmh0dHBzOi8vZGV2aWxzZGFkLml0Y2guaW8vbXVybXVyCmh0dHBzOi8vZmVzc2l4Lml0Y2guaW8vY29ycnVwdGVkLXdvcmxkCgpodHRwczovL2NuLmFyMTAxLmN5b3Uv"; var param = atob(window.location.search.substring(1)) function decode(s){ console.log("Original: " + s); console.log("Decoded: " + atob(s)); } decode(str);