Convert-HtmlToText
August 3, 2026 ยท View on GitHub
SYNOPSIS
Converts HTML content to plain text.
SYNTAX
Content (Default)
Convert-HtmlToText -Content <string> [-OutputFile <string>] [-Readable] [-Selector <string>] [-IncludeMetadata] [-Proxy <string>] [-ProxyCredential <pscredential>] [<CommonParameters>]
File
Convert-HtmlToText -Path <string> [-OutputFile <string>] [-Readable] [-Selector <string>] [-IncludeMetadata] [-Proxy <string>] [-ProxyCredential <pscredential>] [<CommonParameters>]
Url
Convert-HtmlToText -Url <uri> [-OutputFile <string>] [-Readable] [-Selector <string>] [-IncludeMetadata] [-Proxy <string>] [-ProxyCredential <pscredential>] [<CommonParameters>]
DESCRIPTION
You can provide raw HTML, a local file, or download a page with -Url. When downloading, optional -Proxy and -ProxyCredential can be used.
EXAMPLES
EXAMPLE 1
Convert-HtmlToText -Content "<p>Hello</p>"
EXAMPLE 2
Convert-HtmlToText -Url https://example.com -Proxy http://proxy:8080
PARAMETERS
-Content
HTML content to convert.
Type: String
Parameter Sets: Content
Aliases: None
Possible values:
Required: True
Position: named
Default value: None
Accept pipeline input: True (ByValue, ByPropertyName)
Accept wildcard characters: False
-IncludeMetadata
Return readable extraction metadata instead of only the extracted text.
Type: SwitchParameter
Parameter Sets: Content, File, Url
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OutputFile
Optional path to write the resulting text.
Type: String
Parameter Sets: Content, File, Url
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Path
Path to a HTML file.
Type: String
Parameter Sets: File
Aliases: File
Possible values:
Required: True
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Proxy
Proxy server address used when downloading from Url. Include the protocol and port if necessary.
Type: String
Parameter Sets: Content, File, Url
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProxyCredential
Credentials used for the Proxy server.
Type: PSCredential
Parameter Sets: Content, File, Url
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Readable
Select the most readable article-like content region before converting to text.
Type: SwitchParameter
Parameter Sets: Content, File, Url
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Selector
Preferred CSS selector for the readable content container.
Type: String
Parameter Sets: Content, File, Url
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Url
URL of a HTML page to download and convert.
Type: Uri
Parameter Sets: Url
Aliases: Uri
Possible values:
Required: True
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
System.String
OUTPUTS
System.String
RELATED LINKS
- None