[{"data":1,"prerenderedAt":657},["ShallowReactive",2],{"guide-text-encoding-methods":3},{"id":4,"title":5,"body":6,"date":647,"description":648,"extension":649,"meta":650,"navigation":651,"path":652,"readingTime":653,"seo":654,"stem":655,"__hash__":656},"guides\u002Fguides\u002Ftext-encoding-methods.md","Text Encoding Methods",{"type":7,"value":8,"toc":616},"minimark",[9,14,18,26,30,33,121,124,128,133,136,142,153,157,164,169,175,179,209,214,220,224,227,232,238,242,266,271,277,281,379,383,387,400,404,415,419,436,440,451,455,466,470,474,477,483,493,497,500,504,507,511,514,518,521,527,530,537,541,567,571,574,598,602],[10,11,13],"h2",{"id":12},"what-is-text-encoding","What is Text Encoding?",[15,16,17],"p",{},"Text encoding transforms data into a specific format so another system can safely process or transport it. Encoding is always reversible — you can decode the output back to the original input without loss.",[15,19,20,21,25],{},"This makes encoding fundamentally different from encryption and hashing. Encoding solves ",[22,23,24],"strong",{},"compatibility"," problems, not security problems.",[10,27,29],{"id":28},"encoding-vs-encryption","Encoding vs Encryption",[15,31,32],{},"People often confuse encoding with encryption. The distinction matters.",[34,35,36,52],"table",{},[37,38,39],"thead",{},[40,41,42,46,49],"tr",{},[43,44,45],"th",{},"Property",[43,47,48],{},"Encoding",[43,50,51],{},"Encryption",[53,54,55,69,82,95,108],"tbody",{},[40,56,57,63,66],{},[58,59,60],"td",{},[22,61,62],{},"Purpose",[58,64,65],{},"Format compatibility",[58,67,68],{},"Data confidentiality",[40,70,71,76,79],{},[58,72,73],{},[22,74,75],{},"Reversible",[58,77,78],{},"Yes — always",[58,80,81],{},"Yes — with the key",[40,83,84,89,92],{},[58,85,86],{},[22,87,88],{},"Key required",[58,90,91],{},"No",[58,93,94],{},"Yes",[40,96,97,102,105],{},[58,98,99],{},[22,100,101],{},"Security",[58,103,104],{},"None",[58,106,107],{},"Strong (with proper implementation)",[40,109,110,115,118],{},[58,111,112],{},[22,113,114],{},"Examples",[58,116,117],{},"Base64, URL encoding, HTML entities",[58,119,120],{},"AES-256, RSA, ChaCha20",[15,122,123],{},"If you can decode something without a secret key, it is encoding — not encryption. Base64 strings, URL-encoded paths, and HTML entities all decode trivially.",[10,125,127],{"id":126},"common-encoding-methods","Common Encoding Methods",[129,130,132],"h3",{"id":131},"base64","Base64",[15,134,135],{},"Base64 converts binary data into printable ASCII characters using a 64-character alphabet (A–Z, a–z, 0–9, +, \u002F). It increases data size by roughly 33%.",[15,137,138,141],{},[22,139,140],{},"Use it for:"," email attachments (MIME), data URLs, API payloads (JWT), embedding binary data in JSON or XML.",[143,144,149],"pre",{"className":145,"code":147,"language":148},[146],"language-text","Hello World → SGVsbG8gV29ybGQ=\n","text",[150,151,147],"code",{"__ignoreMap":152},"",[129,154,156],{"id":155},"url-encoding-percent-encoding","URL Encoding (Percent Encoding)",[15,158,159,160,163],{},"URL encoding replaces unsafe or reserved characters with a ",[150,161,162],{},"%"," followed by two hexadecimal digits. This ensures URLs remain valid across all systems.",[15,165,166,168],{},[22,167,140],{}," query parameters, form data submission, path segments containing special characters — any time you embed arbitrary text in a URL.",[143,170,173],{"className":171,"code":172,"language":148},[146],"hello world! → hello%20world%21\n",[150,174,172],{"__ignoreMap":152},[129,176,178],{"id":177},"html-entities","HTML Entities",[15,180,181,182,185,186,185,189,185,192,195,196,185,199,185,202,185,205,208],{},"HTML encoding replaces characters that have special meaning in HTML — ",[150,183,184],{},"\u003C",", ",[150,187,188],{},">",[150,190,191],{},"&",[150,193,194],{},"\""," — with entity references like ",[150,197,198],{},"&lt;",[150,200,201],{},"&gt;",[150,203,204],{},"&amp;",[150,206,207],{},"&quot;",". This prevents browsers from interpreting user content as markup.",[15,210,211,213],{},[22,212,140],{}," rendering user-generated text in web pages, preventing XSS in HTML contexts, displaying special characters like © or —.",[143,215,218],{"className":216,"code":217,"language":148},[146],"\u003Cp>Hello & \"World\"\u003C\u002Fp> → &lt;p&gt;Hello &amp; &quot;World&quot;&lt;\u002Fp&gt;\n",[150,219,217],{"__ignoreMap":152},[129,221,223],{"id":222},"rot13","ROT13",[15,225,226],{},"ROT13 shifts each letter by 13 positions in the alphabet. Encoding and decoding are the same operation. It provides no security — only casual obscuration.",[15,228,229,231],{},[22,230,140],{}," hiding spoilers, puzzle hints, content warnings where readers opt in to reveal text.",[143,233,236],{"className":234,"code":235,"language":148},[146],"Spoiler → Fcbvyre\n",[150,237,235],{"__ignoreMap":152},[129,239,241],{"id":240},"unicode-escapes","Unicode Escapes",[15,243,244,245,248,249,252,253,185,256,185,259,185,262,265],{},"Unicode escaping represents characters using escape sequences like ",[150,246,247],{},"\\u0041"," for \"A\" or ",[150,250,251],{},"\\u1F600"," for \"😀\". Different languages and formats use different syntax (",[150,254,255],{},"\\u",[150,257,258],{},"\\U",[150,260,261],{},"&#x;",[150,263,264],{},"%u",").",[15,267,268,270],{},[22,269,140],{}," embedding Unicode in ASCII-only contexts (source code, config files), escaping special characters in JavaScript\u002FJSON strings, representing characters that are hard to type.",[143,272,275],{"className":273,"code":274,"language":148},[146],"Hello → \\u0048\\u0065\\u006C\\u006C\\u006F\n",[150,276,274],{"__ignoreMap":152},[10,278,280],{"id":279},"comparison-table","Comparison Table",[34,282,283,301],{},[37,284,285],{},[40,286,287,290,293,296,298],{},[43,288,289],{},"Method",[43,291,292],{},"Increases Size",[43,294,295],{},"Handles Binary",[43,297,101],{},[43,299,300],{},"Self-Decoding",[53,302,303,318,335,349,364],{},[40,304,305,309,312,314,316],{},[58,306,307],{},[22,308,132],{},[58,310,311],{},"~33%",[58,313,94],{},[58,315,104],{},[58,317,91],{},[40,319,320,325,328,331,333],{},[58,321,322],{},[22,323,324],{},"URL Encoding",[58,326,327],{},"Variable",[58,329,330],{},"Partial",[58,332,104],{},[58,334,91],{},[40,336,337,341,343,345,347],{},[58,338,339],{},[22,340,178],{},[58,342,327],{},[58,344,91],{},[58,346,104],{},[58,348,91],{},[40,350,351,355,358,360,362],{},[58,352,353],{},[22,354,223],{},[58,356,357],{},"0%",[58,359,91],{},[58,361,104],{},[58,363,94],{},[40,365,366,370,373,375,377],{},[58,367,368],{},[22,369,241],{},[58,371,372],{},"300–600%",[58,374,91],{},[58,376,104],{},[58,378,91],{},[10,380,382],{"id":381},"when-to-use-each-method","When to Use Each Method",[129,384,386],{"id":385},"choose-base64-when","Choose Base64 when:",[388,389,390,394,397],"ul",{},[391,392,393],"li",{},"You need to embed binary data (images, files) in text-based formats",[391,395,396],{},"You are working with email attachments or data URLs",[391,398,399],{},"You need to transmit binary data over a text-only channel",[129,401,403],{"id":402},"choose-url-encoding-when","Choose URL encoding when:",[388,405,406,409,412],{},[391,407,408],{},"You are constructing URLs with dynamic query parameters",[391,410,411],{},"User input contains spaces, ampersands, or other reserved URL characters",[391,413,414],{},"You are submitting form data via GET requests",[129,416,418],{"id":417},"choose-html-entities-when","Choose HTML entities when:",[388,420,421,424,433],{},[391,422,423],{},"You are rendering untrusted text inside HTML documents",[391,425,426,427,429,430,432],{},"You need to display characters like ",[150,428,184],{}," or ",[150,431,191],{}," without triggering markup parsing",[391,434,435],{},"You want to show typographic symbols (em dash, copyright)",[129,437,439],{"id":438},"choose-rot13-when","Choose ROT13 when:",[388,441,442,445,448],{},[391,443,444],{},"You want to obscure text from casual reading without any security requirement",[391,446,447],{},"You are hiding spoilers, hints, or answers in a community post",[391,449,450],{},"You need an encoding where encode = decode",[129,452,454],{"id":453},"choose-unicode-escapes-when","Choose Unicode escapes when:",[388,456,457,460,463],{},[391,458,459],{},"You are writing source code in ASCII-only environments",[391,461,462],{},"You need to represent characters that your editor or keyboard cannot type",[391,464,465],{},"You are escaping control characters in JSON or JavaScript strings",[10,467,469],{"id":468},"common-pitfalls","Common Pitfalls",[129,471,473],{"id":472},"double-encoding","Double encoding",[15,475,476],{},"Applying encoding twice creates strings that decode incorrectly unless you also decode twice. This happens often with URL parameters passing through multiple systems.",[143,478,481],{"className":479,"code":480,"language":148},[146],"\"hello world\" → \"hello%20world\" → \"hello%2520world\"\n",[150,482,480],{"__ignoreMap":152},[15,484,485,486,488,489,492],{},"The second encode turns ",[150,487,162],{}," into ",[150,490,491],{},"%25",". Always track whether a string is already encoded.",[129,494,496],{"id":495},"wrong-encoding-for-the-context","Wrong encoding for the context",[15,498,499],{},"URL encoding does not prevent XSS in HTML. HTML entities do not make strings safe for URLs. Each encoding solves a specific transport or rendering problem — use the right one for your context.",[129,501,503],{"id":502},"confusing-encoding-with-encryption","Confusing encoding with encryption",[15,505,506],{},"Encoding is never a security measure. Anyone can decode Base64, URL-encoded strings, or ROT13 instantly. If you need to protect data, use encryption.",[129,508,510],{"id":509},"ignoring-character-sets","Ignoring character sets",[15,512,513],{},"Base64 operates on bytes. If your input text uses different character encodings (UTF-8 vs Latin-1), the Base64 output differs. Always agree on the source encoding first.",[10,515,517],{"id":516},"combining-multiple-encodings","Combining Multiple Encodings",[15,519,520],{},"You can chain encodings when data passes through multiple systems. For example, a JSON API might Base64-encode a binary payload, then URL-encode the Base64 string for a query parameter.",[143,522,525],{"className":523,"code":524,"language":148},[146],"Binary → Base64 → URL Encode → Send in URL\n",[150,526,524],{"__ignoreMap":152},[15,528,529],{},"When decoding, reverse the order: URL-decode first, then Base64-decode.",[15,531,532,533,536],{},"The critical rule: ",[22,534,535],{},"always decode in the reverse order of encoding",". Each layer wraps the previous one, so you must unwrap from the outside in.",[10,538,540],{"id":539},"key-takeaways","Key Takeaways",[388,542,543,546,549,552,555,558,561,564],{},[391,544,545],{},"Encoding solves format compatibility, not security",[391,547,548],{},"Base64 handles binary data in text channels but increases size by 33%",[391,550,551],{},"URL encoding makes arbitrary text safe for URLs",[391,553,554],{},"HTML entities prevent markup interpretation and XSS",[391,556,557],{},"ROT13 offers casual obscuration with zero security",[391,559,560],{},"Unicode escapes represent characters in ASCII-only contexts",[391,562,563],{},"Never confuse encoding with encryption — one is reversible by design, the other requires a key",[391,565,566],{},"Decode in reverse order when combining multiple encodings",[10,568,570],{"id":569},"try-it-yourself","Try It Yourself",[15,572,573],{},"Experiment with different encoding methods using our free online tools:",[388,575,576,584,591],{},[391,577,578,583],{},[579,580,582],"a",{"href":581},"\u002Ftools\u002Frot13","ROT13 Tool"," — encode and decode ROT13 text instantly",[391,585,586,590],{},[579,587,589],{"href":588},"\u002Ftools\u002Fbase64","Base64 Encoder\u002FDecoder"," — convert text and binary data to Base64 and back",[391,592,593,597],{},[579,594,596],{"href":595},"\u002Ftools\u002Furl-encoder","URL Encoder"," — encode and decode URLs and query parameters",[10,599,601],{"id":600},"related-guides","Related Guides",[388,603,604,610],{},[391,605,606],{},[579,607,609],{"href":608},"\u002Fguides\u002Frot13-explained","ROT13 Explained",[391,611,612],{},[579,613,615],{"href":614},"\u002Fguides\u002Fdata-obfuscation-tools","Data Obfuscation Tools",{"title":152,"searchDepth":617,"depth":617,"links":618},2,[619,620,621,629,630,637,643,644,645,646],{"id":12,"depth":617,"text":13},{"id":28,"depth":617,"text":29},{"id":126,"depth":617,"text":127,"children":622},[623,625,626,627,628],{"id":131,"depth":624,"text":132},3,{"id":155,"depth":624,"text":156},{"id":177,"depth":624,"text":178},{"id":222,"depth":624,"text":223},{"id":240,"depth":624,"text":241},{"id":279,"depth":617,"text":280},{"id":381,"depth":617,"text":382,"children":631},[632,633,634,635,636],{"id":385,"depth":624,"text":386},{"id":402,"depth":624,"text":403},{"id":417,"depth":624,"text":418},{"id":438,"depth":624,"text":439},{"id":453,"depth":624,"text":454},{"id":468,"depth":617,"text":469,"children":638},[639,640,641,642],{"id":472,"depth":624,"text":473},{"id":495,"depth":624,"text":496},{"id":502,"depth":624,"text":503},{"id":509,"depth":624,"text":510},{"id":516,"depth":617,"text":517},{"id":539,"depth":617,"text":540},{"id":569,"depth":617,"text":570},{"id":600,"depth":617,"text":601},"2026-05-28","Comparing text encoding methods — Base64, URL encoding, HTML entities, ROT13, and Unicode escapes — and when to use each.","md",{"immutable":651},true,"\u002Fguides\u002Ftext-encoding-methods",7,{"title":5,"description":648},"guides\u002Ftext-encoding-methods","BA_L86Snvlite8_TJq5N_uYPIudjKFegECK6ypv1o3A",1780401330693]