HTML Encoder/Decoder for Go
Free online html encoder/decoder with Go code examples
Working with html encoder/decoder in Go? Our free online html encoder/decoder helps Go developers format, validate, and process data instantly. Below you will find Go code examples using html (built-in) so you can achieve the same result programmatically in your own projects.
Try the HTML Encoder/Decoder Online
Use our free HTML Encoder/Decoder directly in your browser — no setup required.
Open HTML Encoder/DecoderGo Code Example
package main
import (
"fmt"
"html"
)
func main() {
raw := `<script>alert("XSS")</script>`
// Encode
encoded := html.EscapeString(raw)
fmt.Println(encoded)
// Decode
decoded := html.UnescapeString(encoded)
fmt.Println(decoded)
}Quick Setup
Library: html (built-in)
// Built-in package — no installation neededGo Tips & Best Practices
- html.EscapeString encodes the five XML special characters
- html.UnescapeString handles named and numeric references
- Use html/template for auto-escaping in HTML templates