-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathurl-encoder.html
More file actions
1715 lines (1628 loc) · 79.9 KB
/
Copy pathurl-encoder.html
File metadata and controls
1715 lines (1628 loc) · 79.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-CT8E5N460D"></script>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','G-CT8E5N460D');</script>
<title>URL Encode Decode - Free Online | No Ads, No Signup</title>
<meta name="description" content="Free online URL encoder and decoder. Encode/decode URLs, query strings and special characters. Parse URL components, build URLs from parameters. No ads, no signup, runs entirely in your browser.">
<meta name="keywords" content="URL encoder, URL decoder, URL encode online, URL decode online, percent encoding, no ads, no signup, no login, free unlimited, browser-based, no installation">
<meta name="author" content="UseMagicTools">
<meta name="robots" content="index, follow">
<meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
<meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
<meta name="revisit-after" content="7 days">
<meta name="rating" content="general">
<meta name="distribution" content="global">
<meta name="language" content="English">
<link rel="alternate" hreflang="en" href="https://www.usemagictools.com/url-encoder.html">
<link rel="alternate" hreflang="zh-CN" href="https://www.usemagictools.com/url-encoder.html">
<link rel="alternate" hreflang="fr" href="https://www.usemagictools.com/url-encoder.html">
<link rel="alternate" hreflang="es" href="https://www.usemagictools.com/url-encoder.html">
<link rel="alternate" hreflang="x-default" href="https://www.usemagictools.com/url-encoder.html">
<link rel="canonical" href="https://www.usemagictools.com/url-encoder.html">
<!-- Open Graph -->
<meta property="og:type" content="website">
<meta property="og:title" content="URL Encode Decode - Free Online | No Ads, No Signup">
<meta property="og:description" content="Free online URL encoder and decoder. Encode/decode URLs, query strings and special characters. Parse URL components, build URLs from parameters. No ads, no signup, runs entirely in your browser.">
<meta property="og:url" content="https://www.usemagictools.com/url-encoder.html">
<meta property="og:image" content="https://www.usemagictools.com/screenshots/url-encoder-v1.webp">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:site_name" content="Magic Toolbox">
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@usemagictools">
<meta name="twitter:creator" content="@usemagictools">
<meta name="twitter:title" content="URL Encode Decode - Free Online | No Ads, No Signup">
<meta name="twitter:description" content="Free online URL encoder and decoder. Encode/decode URLs and query strings. Parse URL components.">
<meta name="twitter:image" content="https://www.usemagictools.com/screenshots/url-encoder-v1.webp">
<!-- JSON-LD 结构化数据 -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"inLanguage": ["en", "zh-CN", "fr", "es"],
"name": "URL Encoder/Decoder",
"alternateName": ["URL 编解码", "Percent Encoding Tool", "URL Parser Online"],
"url": "https://www.usemagictools.com/url-encoder.html",
"description": "Free online URL encoder and decoder. Encode/decode URLs, query strings and special characters. Parse URL components, build URLs from parameters. No ads, no signup, runs entirely in your browser.",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "Any",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"author": {
"@type": "Person",
"name": "UseMagicTools"
},
"publisher": {
"@type": "Organization",
"name": "Web Toolbox",
"url": "https://www.usemagictools.com/"
},
"featureList": [
"URL encoding with encodeURI and encodeURIComponent",
"URL decoding with decodeURI and decodeURIComponent",
"Batch line-by-line encoding and decoding",
"Full URL parser with component breakdown",
"Interactive query parameter editor",
"Real-time URL rebuilding",
"Multi-language support (EN, ZH, FR, ES)",
"100% client-side processing, no data sent to server",
"No ads",
"No signup required",
"100% browser-based",
"Unlimited usage"
],
"screenshot": "https://www.usemagictools.com/screenshots/url-encoder-v1.webp"
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.usemagictools.com/"
},
{
"@type": "ListItem",
"position": 2,
"name": "URL Encoder Decoder",
"item": "https://www.usemagictools.com/url-encoder.html"
}
]
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is URL encoding (percent encoding)?",
"acceptedAnswer": {
"@type": "Answer",
"text": "URL encoding, also known as percent-encoding, is a mechanism for encoding information in a URI. Special characters are replaced with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII value. For example, a space becomes %20 and an ampersand becomes %26."
}
},
{
"@type": "Question",
"name": "What's the difference between encodeURI and encodeURIComponent?",
"acceptedAnswer": {
"@type": "Answer",
"text": "encodeURI encodes a complete URI while preserving structural characters like :, /, ?, #, [], @, !, $, &, and =. encodeURIComponent encodes all special characters including these structural ones, making it suitable for encoding individual query parameter values. Use encodeURI for full URLs and encodeURIComponent for parameter values within URLs. This free tool demonstrates both methods with no signup needed."
}
},
{
"@type": "Question",
"name": "When do I need URL encoding?",
"acceptedAnswer": {
"@type": "Answer",
"text": "URL encoding is needed when passing special characters in URL query parameters, form data, API requests, or any context where characters like spaces, ampersands, equals signs, or non-ASCII characters appear in a URL."
}
},
{
"@type": "Question",
"name": "Can I process multiple URLs at once?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Yes, this tool supports batch mode. Simply enable the Batch Mode toggle and enter one string per line. Each line will be encoded or decoded independently, making it easy to process multiple values at once."
}
},
{
"@type": "Question",
"name": "Is this tool free and safe?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Yes, this tool is completely free and runs entirely in your browser. No data is sent to any server — all encoding, decoding, and parsing happens client-side using JavaScript, ensuring your data stays private."
}
},
{
"@type": "Question",
"name": "Is this tool really free with no ads or signup?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Absolutely! This URL encoder/decoder is 100% free with no ads, no signup, no login, and no usage limits. It runs entirely in your browser — no data is sent to any server, no account is needed, and there are no hidden costs. Use it as much as you want, anytime."
}
}
]
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "HowTo",
"name": "How to Encode and Decode URLs",
"description": "Learn how to encode and decode URLs using this free online tool. Supports both encodeURI and encodeURIComponent modes.",
"step": [
{
"@type": "HowToStep",
"position": 1,
"name": "Choose the operation",
"text": "Select the Encode, Decode, or URL Parser tab depending on what you need to do."
},
{
"@type": "HowToStep",
"position": 2,
"name": "Select the encoding mode",
"text": "Choose between encodeURIComponent (for query parameter values) or encodeURI (for full URIs) depending on your use case."
},
{
"@type": "HowToStep",
"position": 3,
"name": "Enter your text or URL",
"text": "Type or paste the text you want to encode/decode into the input field. Enable Batch Mode to process multiple lines at once."
},
{
"@type": "HowToStep",
"position": 4,
"name": "Get the result",
"text": "The result appears instantly in the output field. Click the Copy button to copy it to your clipboard."
}
],
"tool": {
"@type": "HowToTool",
"name": "URL Encoder/Decoder Online Tool"
}
}
</script>
<style>
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
color: #e4e4e7;
min-height: 100vh;
padding: 0;
}
/* 标题 */
.page-header {
text-align: center;
margin-bottom: 30px;
}
.page-header h1 {
font-size: 28px;
font-weight: 700;
background: linear-gradient(135deg, #a78bfa, #7c3aed);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 8px;
}
.page-header p {
color: #a1a1aa;
font-size: 15px;
}
/* 主容器 */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 40px;
}
/* Tab 栏 */
.tab-bar {
display: flex;
gap: 4px;
background: rgba(0,0,0,0.3);
border-radius: 12px;
padding: 4px;
margin-bottom: 24px;
}
.tab-btn {
flex: 1;
padding: 12px 20px;
background: none;
border: none;
color: #a1a1aa;
font-size: 15px;
font-weight: 500;
cursor: pointer;
border-radius: 10px;
transition: all 0.3s ease;
}
.tab-btn:hover { color: #e4e4e7; background: rgba(255,255,255,0.05); }
.tab-btn.active {
background: linear-gradient(135deg, #7c3aed, #6d28d9);
color: #fff;
box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}
/* 面板 */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* 卡片 */
.card {
background: rgba(0,0,0,0.3);
border: 1px solid rgba(255,255,255,0.06);
border-radius: 16px;
padding: 24px;
margin-bottom: 20px;
}
/* 标签 */
label {
display: block;
font-size: 14px;
font-weight: 500;
color: #a1a1aa;
margin-bottom: 8px;
}
/* 文本框 */
textarea {
width: 100%;
min-height: 120px;
background: rgba(0,0,0,0.3);
border: 1px solid rgba(255,255,255,0.1);
border-radius: 10px;
padding: 14px;
color: #e4e4e7;
font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
font-size: 14px;
resize: vertical;
transition: border-color 0.3s ease;
line-height: 1.6;
}
textarea:focus { outline: none; border-color: #7c3aed; }
textarea::placeholder { color: #52525b; }
input[type="text"] {
width: 100%;
background: rgba(0,0,0,0.3);
border: 1px solid rgba(255,255,255,0.1);
border-radius: 10px;
padding: 12px 14px;
color: #e4e4e7;
font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
font-size: 14px;
transition: border-color 0.3s ease;
}
input[type="text"]:focus { outline: none; border-color: #7c3aed; }
input[type="text"]::placeholder { color: #52525b; }
/* 模式切换 */
.mode-switch {
display: flex;
gap: 4px;
background: rgba(0,0,0,0.25);
border-radius: 8px;
padding: 3px;
margin-bottom: 16px;
}
.mode-btn {
flex: 1;
padding: 8px 14px;
background: none;
border: none;
color: #a1a1aa;
font-size: 13px;
cursor: pointer;
border-radius: 6px;
transition: all 0.3s ease;
font-family: 'SF Mono', monospace;
}
.mode-btn:hover { color: #e4e4e7; }
.mode-btn.active {
background: rgba(124,58,237,0.3);
color: #c4b5fd;
}
/* 批量模式开关 */
.batch-toggle {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 16px;
}
.toggle-switch {
position: relative;
width: 44px;
height: 24px;
cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(255,255,255,0.1);
border-radius: 12px;
transition: all 0.3s ease;
}
.toggle-slider::before {
content: '';
position: absolute;
width: 18px;
height: 18px;
left: 3px;
bottom: 3px;
background: #e4e4e7;
border-radius: 50%;
transition: all 0.3s ease;
}
.toggle-switch input:checked + .toggle-slider { background: #7c3aed; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-label { font-size: 14px; color: #a1a1aa; }
/* 按钮 */
.btn-row {
display: flex;
gap: 10px;
flex-wrap: wrap;
margin-top: 16px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 6px;
}
.btn-primary {
background: linear-gradient(135deg, #7c3aed, #6d28d9);
color: #fff;
}
.btn-primary:hover { box-shadow: 0 4px 12px rgba(124,58,237,0.4); transform: translateY(-1px); }
.btn-secondary {
background: rgba(255,255,255,0.08);
color: #e4e4e7;
border: 1px solid rgba(255,255,255,0.1);
}
.btn-secondary:hover { background: rgba(255,255,255,0.12); }
/* 结果区 */
.result-area {
position: relative;
}
.copy-btn {
position: absolute;
top: 8px;
right: 8px;
padding: 6px 12px;
background: rgba(124,58,237,0.3);
border: 1px solid rgba(124,58,237,0.4);
border-radius: 6px;
color: #c4b5fd;
font-size: 12px;
cursor: pointer;
transition: all 0.3s ease;
z-index: 2;
}
.copy-btn:hover { background: rgba(124,58,237,0.5); }
.copy-btn.copied { background: rgba(34,197,94,0.3); border-color: rgba(34,197,94,0.4); color: #86efac; }
/* URL 解析 */
.parse-table {
width: 100%;
border-collapse: collapse;
margin-top: 16px;
}
.parse-table th,
.parse-table td {
padding: 10px 14px;
text-align: left;
border-bottom: 1px solid rgba(255,255,255,0.06);
font-size: 14px;
}
.parse-table th {
color: #a78bfa;
font-weight: 500;
white-space: nowrap;
width: 120px;
}
.parse-table td {
color: #e4e4e7;
word-break: break-all;
font-family: 'SF Mono', monospace;
}
/* Query 参数表格 */
.params-section { margin-top: 20px; }
.params-section h3 {
font-size: 15px;
font-weight: 600;
color: #c4b5fd;
margin-bottom: 12px;
}
.params-table {
width: 100%;
border-collapse: collapse;
}
.params-table th {
padding: 10px 14px;
text-align: left;
background: rgba(124,58,237,0.15);
color: #c4b5fd;
font-size: 13px;
font-weight: 500;
}
.params-table th:first-child { border-radius: 8px 0 0 0; }
.params-table th:last-child { border-radius: 0 8px 0 0; }
.params-table td {
padding: 8px 10px;
border-bottom: 1px solid rgba(255,255,255,0.04);
}
.params-table td input {
width: 100%;
background: rgba(0,0,0,0.2);
border: 1px solid rgba(255,255,255,0.08);
border-radius: 6px;
padding: 8px 10px;
color: #e4e4e7;
font-size: 13px;
font-family: 'SF Mono', monospace;
}
.params-table td input:focus { outline: none; border-color: #7c3aed; }
.param-action-btn {
padding: 6px 10px;
background: rgba(239,68,68,0.2);
border: none;
border-radius: 4px;
color: #fca5a5;
cursor: pointer;
font-size: 12px;
transition: background 0.2s ease;
}
.param-action-btn:hover { background: rgba(239,68,68,0.4); }
.add-param-btn {
margin-top: 10px;
padding: 8px 16px;
background: rgba(124,58,237,0.15);
border: 1px dashed rgba(124,58,237,0.4);
border-radius: 8px;
color: #a78bfa;
font-size: 13px;
cursor: pointer;
transition: all 0.2s ease;
width: 100%;
}
.add-param-btn:hover { background: rgba(124,58,237,0.25); }
/* 构建的 URL */
.built-url-area {
margin-top: 16px;
padding: 14px;
background: rgba(0,0,0,0.25);
border-radius: 10px;
border: 1px solid rgba(255,255,255,0.06);
position: relative;
}
.built-url-label {
font-size: 12px;
color: #a1a1aa;
margin-bottom: 6px;
}
.built-url-text {
font-family: 'SF Mono', monospace;
font-size: 13px;
color: #86efac;
word-break: break-all;
line-height: 1.5;
user-select: all;
}
/* 错误信息 */
.error-msg {
color: #fca5a5;
font-size: 13px;
margin-top: 8px;
display: none;
}
.error-msg.show { display: block; }
/* 提示 */
.toast {
position: fixed;
bottom: 30px;
left: 50%;
transform: translateX(-50%) translateY(20px);
background: rgba(34,197,94,0.9);
color: #fff;
padding: 10px 24px;
border-radius: 8px;
font-size: 14px;
opacity: 0;
transition: all 0.3s ease;
z-index: 9999;
pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* 空状态 */
.empty-state {
text-align: center;
color: #52525b;
padding: 30px;
font-size: 14px;
}
/* ==================== 功能特点区域 ==================== */
.features-section {
margin: 30px 0 0;
}
.features-section h3 {
text-align: center;
font-size: 22px;
font-weight: 700;
background: linear-gradient(135deg, #a78bfa, #7c3aed);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 24px;
}
.features-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 16px;
}
.feature-card {
background: rgba(0,0,0,0.3);
border: 1px solid rgba(255,255,255,0.06);
border-radius: 16px;
padding: 24px;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.feature-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 24px rgba(124,58,237,0.15);
}
.feature-icon {
font-size: 28px;
margin-bottom: 12px;
}
.feature-card h3 {
font-size: 16px;
font-weight: 600;
color: #c4b5fd;
margin-bottom: 8px;
}
.feature-card p {
font-size: 14px;
color: #a1a1aa;
line-height: 1.6;
}
/* ==================== FAQ 手风琴 ==================== */
.faq-section {
margin: 30px 0 0;
}
.faq-section h3 {
text-align: center;
font-size: 22px;
font-weight: 700;
background: linear-gradient(135deg, #a78bfa, #7c3aed);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 24px;
}
.faq-item {
background: rgba(0,0,0,0.3);
border: 1px solid rgba(255,255,255,0.06);
border-radius: 12px;
margin-bottom: 10px;
overflow: hidden;
transition: border-color 0.3s ease;
}
.faq-item:hover {
border-color: rgba(124,58,237,0.3);
}
.faq-question {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 18px 20px;
background: transparent;
border: none;
color: #e4e4e7;
font-size: 15px;
font-weight: 500;
text-align: left;
cursor: pointer;
transition: background 0.3s ease;
}
.faq-question:hover {
background: rgba(255,255,255,0.03);
}
.faq-question::after {
content: "+";
font-size: 1.4rem;
font-weight: 300;
color: var(--text-secondary, #a1a1aa);
transition: transform 0.3s ease;
flex-shrink: 0;
}
.faq-item.active .faq-question::after {
transform: rotate(45deg);
}
.faq-answer {
max-height: 0;
overflow: hidden;
transition: max-height 0.35s ease, padding 0.35s ease;
}
.faq-item.active .faq-answer {
max-height: 300px;
}
.faq-answer p {
padding: 0 20px 18px;
font-size: 14px;
color: #a1a1aa;
line-height: 1.7;
}
/* ==================== 相关工具推荐 ==================== */
/* 响应式 */
@media (max-width: 768px) {
.container { padding: 20px; }
.page-header h1 { font-size: 22px; }
.tab-btn { padding: 10px 12px; font-size: 13px; }
.card { padding: 16px; }
.btn-row { flex-direction: column; }
.btn { width: 100%; justify-content: center; }
.parse-table th { width: 90px; }
.features-grid { grid-template-columns: 1fr; }
}
</style>
<link rel="stylesheet" href="common/common.css">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="icon" href="/favicon.ico" sizes="48x48">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
</head>
<body>
<div class="container">
<div class="page-header">
<h1 data-i18n="pageTitle">URL Encoder / Decoder</h1>
<p data-i18n="pageDesc">Encode, decode, and parse URLs online — fast, free, and private.</p>
</div>
<!-- Tab 栏 -->
<div class="tab-bar">
<button class="tab-btn active" data-tab="encode" data-i18n="tabEncode">Encode</button>
<button class="tab-btn" data-tab="decode" data-i18n="tabDecode">Decode</button>
<button class="tab-btn" data-tab="parser" data-i18n="tabParser">URL Parser</button>
</div>
<!-- ========== 编码面板 ========== -->
<div class="tab-panel active" id="panel-encode">
<div class="card">
<div class="mode-switch">
<button class="mode-btn active" data-encode-mode="component">encodeURIComponent</button>
<button class="mode-btn" data-encode-mode="uri">encodeURI</button>
</div>
<div class="batch-toggle">
<label class="toggle-switch">
<input type="checkbox" id="encodeBatch">
<span class="toggle-slider"></span>
</label>
<span class="toggle-label" data-i18n="batchMode">Batch Mode (line by line)</span>
</div>
<label data-i18n="inputLabel">Input</label>
<textarea id="encodeInput" data-i18n-placeholder="encodePlaceholder" placeholder="Enter text to encode..."></textarea>
<div class="error-msg" id="encodeError"></div>
<div class="btn-row">
<button class="btn btn-secondary" onclick="APP.clearField('encodeInput','encodeOutput')" data-i18n="btnClear">Clear</button>
<button class="btn btn-secondary" onclick="APP.swapTab('decode','encodeOutput')" data-i18n="btnSendToDecode">Send to Decode</button>
</div>
</div>
<div class="card">
<label data-i18n="outputLabel">Output</label>
<div class="result-area">
<button class="copy-btn" onclick="APP.copyResult('encodeOutput', this)" data-i18n="btnCopy">Copy</button>
<textarea id="encodeOutput" readonly data-i18n-placeholder="resultPlaceholder" placeholder="Encoded result will appear here..."></textarea>
</div>
</div>
</div>
<!-- ========== 解码面板 ========== -->
<div class="tab-panel" id="panel-decode">
<div class="card">
<div class="mode-switch">
<button class="mode-btn active" data-decode-mode="component">decodeURIComponent</button>
<button class="mode-btn" data-decode-mode="uri">decodeURI</button>
</div>
<div class="batch-toggle">
<label class="toggle-switch">
<input type="checkbox" id="decodeBatch">
<span class="toggle-slider"></span>
</label>
<span class="toggle-label" data-i18n="batchMode">Batch Mode (line by line)</span>
</div>
<label data-i18n="inputLabel">Input</label>
<textarea id="decodeInput" data-i18n-placeholder="decodePlaceholder" placeholder="Enter URL-encoded text to decode..."></textarea>
<div class="error-msg" id="decodeError"></div>
<div class="btn-row">
<button class="btn btn-secondary" onclick="APP.clearField('decodeInput','decodeOutput')" data-i18n="btnClear">Clear</button>
<button class="btn btn-secondary" onclick="APP.swapTab('encode','decodeOutput')" data-i18n="btnSendToEncode">Send to Encode</button>
</div>
</div>
<div class="card">
<label data-i18n="outputLabel">Output</label>
<div class="result-area">
<button class="copy-btn" onclick="APP.copyResult('decodeOutput', this)" data-i18n="btnCopy">Copy</button>
<textarea id="decodeOutput" readonly data-i18n-placeholder="resultPlaceholder" placeholder="Decoded result will appear here..."></textarea>
</div>
</div>
</div>
<!-- ========== URL 解析面板 ========== -->
<div class="tab-panel" id="panel-parser">
<div class="card">
<label data-i18n="urlInputLabel">URL</label>
<input type="text" id="parserInput" data-i18n-placeholder="parserPlaceholder" placeholder="Enter a full URL to parse, e.g. https://example.com/path?key=value#hash">
<div class="error-msg" id="parserError"></div>
<div class="btn-row">
<button class="btn btn-secondary" onclick="APP.clearParser()" data-i18n="btnClear">Clear</button>
<button class="btn btn-primary" onclick="APP.parseURL()" data-i18n="btnParse">Parse URL</button>
</div>
</div>
<div class="card" id="parserResultCard" style="display:none;">
<label data-i18n="urlComponents">URL Components</label>
<table class="parse-table">
<tbody>
<tr><th data-i18n="compProtocol">Protocol</th><td id="comp-protocol">-</td></tr>
<tr><th data-i18n="compHost">Host</th><td id="comp-host">-</td></tr>
<tr><th data-i18n="compPort">Port</th><td id="comp-port">-</td></tr>
<tr><th data-i18n="compPath">Path</th><td id="comp-path">-</td></tr>
<tr><th data-i18n="compQuery">Query String</th><td id="comp-query">-</td></tr>
<tr><th data-i18n="compHash">Hash</th><td id="comp-hash">-</td></tr>
</tbody>
</table>
<div class="params-section">
<h3 data-i18n="queryParams">Query Parameters</h3>
<table class="params-table" id="paramsTable">
<thead>
<tr>
<th data-i18n="paramKey">Key</th>
<th data-i18n="paramValue">Value</th>
<th data-i18n="paramAction">Action</th>
</tr>
</thead>
<tbody id="paramsBody"></tbody>
</table>
<div class="empty-state" id="noParams" data-i18n="noParams">No query parameters</div>
<button class="add-param-btn" onclick="APP.addParam()" data-i18n="btnAddParam">+ Add Parameter</button>
</div>
<div class="built-url-area">
<div class="built-url-label" data-i18n="builtUrl">Built URL</div>
<div class="built-url-text" id="builtUrl">-</div>
<button class="copy-btn" style="top:8px;right:8px;" onclick="APP.copyBuiltUrl(this)" data-i18n="btnCopy">Copy</button>
</div>
</div>
</div>
<div class="trust-bar">
<span class="trust-item" data-i18n="trust_users">🌍 Used by 50,000+ users</span>
<span class="trust-item" data-i18n="trust_rating">⭐ 4.9/5 rating</span>
<span class="trust-item" data-i18n="trust_privacy">🔒 100% Private</span>
<span class="trust-item" data-i18n="trust_free">🚫 No Ads, No Signup</span>
</div>
<!-- 功能特点 -->
<section class="features-section">
<h3 data-i18n="featuresTitle">Key Features</h3>
<div class="features-grid">
<div class="feature-card">
<div class="feature-icon">🔒</div>
<h3 data-i18n="feature1Title">100% Free & Private</h3>
<p data-i18n="feature1Desc">No ads, no signup, no watermark. Everything runs locally in your browser. Your data never leaves your device.</p>
</div>
<div class="feature-card">
<div class="feature-icon">📋</div>
<h3 data-i18n="featureBatchTitle">Batch Processing</h3>
<p data-i18n="featureBatchDesc">Batch line-by-line encoding and decoding — process multiple strings at once.</p>
</div>
<div class="feature-card">
<div class="feature-icon">🔍</div>
<h3 data-i18n="featureParserTitle">URL Parser</h3>
<p data-i18n="featureParserDesc">Fully parse all URL components and display them visually in a structured breakdown.</p>
</div>
<div class="feature-card">
<div class="feature-icon">✏️</div>
<h3 data-i18n="featureEditorTitle">Parameter Editor</h3>
<p data-i18n="featureEditorDesc">Interactively edit URL query parameters and rebuild the URL in real time.</p>
</div>
</div>
</section>
<!-- FAQ -->
<section class="faq-section">
<h3 data-i18n="faqTitle">Frequently Asked Questions</h3>
<div class="faq-list">
<div class="faq-item">
<button class="faq-question" data-i18n="faqQ1">What is URL encoding (percent encoding)?</button>
<div class="faq-answer">
<p data-i18n="faqA1">URL encoding, also known as percent-encoding, is a mechanism for encoding information in a URI. Special characters are replaced with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII value. For example, a space becomes %20 and an ampersand (&) becomes %26. This ensures URLs are transmitted correctly over the Internet.</p>
</div>
</div>
<div class="faq-item">
<button class="faq-question" data-i18n="faqQ2">What's the difference between encodeURI and encodeURIComponent?</button>
<div class="faq-answer">
<p data-i18n="faqA2">encodeURI encodes a complete URI but preserves URL structure characters like ://?#[]@!$&'()*+,;=. It is used when you want to encode a full URL while keeping it valid. encodeURIComponent encodes all special characters including URL structure characters, making it suitable for encoding individual query parameter values or path segments.</p>
</div>
</div>
<div class="faq-item">
<button class="faq-question" data-i18n="faqQ3">When do I need URL encoding?</button>
<div class="faq-answer">
<p data-i18n="faqA3">URL encoding is needed when passing special characters in URL query parameters, form data, API requests, or any context where characters like spaces, ampersands, equals signs, or non-ASCII characters (such as Chinese, Japanese, or emoji) appear in a URL. Without encoding, these characters may break the URL or be misinterpreted.</p>
</div>
</div>
<div class="faq-item">
<button class="faq-question" data-i18n="faqQ4">Can I process multiple URLs at once?</button>
<div class="faq-answer">
<p data-i18n="faqA4">Yes! This tool supports batch mode. Simply enable the "Batch Mode" toggle and enter one string per line. Each line will be encoded or decoded independently, making it easy to process multiple values at once without repeating the operation.</p>
</div>
</div>
<div class="faq-item">
<button class="faq-question" data-i18n="faqQ5">Is this tool free and safe?</button>
<div class="faq-answer">
<p data-i18n="faqA5">Yes, this tool is completely free with no usage limits. All processing happens entirely in your browser using JavaScript — no data is ever sent to any server. Your URLs and data remain 100% private and secure on your device.</p>
</div>
</div>
<div class="faq-item">
<button class="faq-question" data-i18n="faqFreeQ">Is this tool really free with no ads or signup?</button>
<div class="faq-answer">
<p data-i18n="faqFreeA">Absolutely! This URL encoder/decoder is 100% free with no ads, no signup, no login, and no usage limits. It runs entirely in your browser — no data is sent to any server, no account is needed, and there are no hidden costs. Use it as much as you want, anytime.</p>
</div>
</div>
</div>
</section>
<!-- 相关工具推荐 -->
<section class="related-tools">
<h3 data-i18n="relatedToolsTitle">Related Tools</h3>
<div class="related-grid">
<a href="base64-tool.html" class="related-card">
<div>🔣</div>
<h4 data-i18n="relatedTool1">Base64 Encoder/Decoder</h4>
<p data-i18n="relatedTool1Desc">Encode and decode Base64 strings</p>
</a>
<a href="crypto-tools.html" class="related-card">
<div>🛡️</div>
<h4 data-i18n="relatedTool2">Crypto & Encoding Toolkit</h4>
<p data-i18n="relatedTool2Desc">MD5, SHA, AES encryption tools</p>
</a>
<a href="json-viewer.html" class="related-card">
<div>📊</div>
<h4 data-i18n="relatedTool3">JSON Viewer</h4>
<p data-i18n="relatedTool3Desc">Format and validate JSON data</p>
</a>
<a href="password-generator.html" class="related-card">
<div>🔐</div>
<h4 data-i18n="relatedTool4">Password Generator</h4>
<p data-i18n="relatedTool4Desc">Generate secure random passwords</p>
</a>
</div>
</section>
</div>
<div class="toast" id="toast"></div>
<script>
(function() {
'use strict';
// ==================== 国际化 ====================
const I18N = {
en: {
tool_name: 'URL Encoder/Decoder',
backHome: '\u2190 Back to Toolbox',
pageTitle: 'URL Encoder / Decoder',
pageDesc: 'Encode, decode, and parse URLs online \u2014 fast, free, and private.',
tabEncode: 'Encode',
tabDecode: 'Decode',
tabParser: 'URL Parser',
batchMode: 'Batch Mode (line by line)',
inputLabel: 'Input',
outputLabel: 'Output',
urlInputLabel: 'URL',
encodePlaceholder: 'Enter text to encode...',
decodePlaceholder: 'Enter URL-encoded text to decode...',
resultPlaceholder: 'Result will appear here...',
parserPlaceholder: 'Enter a full URL to parse, e.g. https://example.com/path?key=value#hash',
btnClear: 'Clear',
btnCopy: 'Copy',
btnCopied: 'Copied!',
btnParse: 'Parse URL',
btnSendToDecode: 'Send to Decode',
btnSendToEncode: 'Send to Encode',
btnAddParam: '+ Add Parameter',
urlComponents: 'URL Components',
compProtocol: 'Protocol',
compHost: 'Host',
compPort: 'Port',
compPath: 'Path',
compQuery: 'Query String',
compHash: 'Hash',
queryParams: 'Query Parameters',
paramKey: 'Key',
paramValue: 'Value',
paramAction: 'Action',
paramDelete: 'Delete',
noParams: 'No query parameters',
builtUrl: 'Built URL',
errInvalidUrl: 'Invalid URL. Please enter a valid URL starting with http:// or https://',
errEncode: 'Encoding error: ',
errDecode: 'Decoding error: ',
toastCopied: 'Copied to clipboard!',
featuresTitle: 'Key Features',
feature1Title: '100% Free & Private',
feature1Desc: 'No ads, no signup, no watermark. Everything runs locally in your browser. Your data never leaves your device.',
featureEncodeTitle: 'Encode & Decode',