Introduction
This blog explains how to quickly remove all hyperlinks in Google Docs. Hyperlinks often get automatically added when you paste content from websites, emails or documents. While useful in some cases, they can clutter up your text or distract readers in formal reports, school assignments or printed handouts. In Microsoft Office, there is a feature that allows you to remove all hyperlinks at once with a shortcut. If you're looking for a clean, link-free document, this guide will walk you through simple methods, manual and automated to remove all hyperlinks at once in Google Docs, saving time and effort.
Method 1: Use MS Word
This is a popular workaround you can use :
- Step 1 : Export the Doc to Word .docx by File > Download as > Microsoft Word.
- Step 2 : Open the .docx. Select the text with hyperlinks.
- Step 3 : Press shortcut Ctrl + Shift + F9.
- Step4 : The hyperlinks will go away.
- Step 5 : Clean the hyperlink underlines with Format Painter.
Method 2: Use Apps Script
This method is more technical and works perfectly.
- Step 1 : Copy the apps script to your Docs script editor with the name Remove all hyperlinks. If you don't know how to do it, here is a tutorial on how to add an apps script to your Docs.
- Step 2 : Select the text in which you want to remove all hyperlinks. It doesn't have to be the entire document.
- Step 3 : Click menu Add-ons > Remove all hyperlinks > Remove all hyperlinks.
- Step 4 : The hyperlinks shall be removed while the format is kept.

/**
* @license MIT
*
* © 2020 xfanatical.com. All Rights Reserved.
* @since 1.0.0 remove links
* @since 1.0.1 fixed a typo
*/
function onOpen() {
DocumentApp.getUi()
.createAddonMenu()
.addItem('Remove all hyperlinks', 'init')
.addToUi()
}
/**
* Get an array of all LinkUrls in the element
* @param {Element} element The document element to operate on.
* @returns {Array} Array of objects,
* {
* element,
* startOffset,
* endOffsetInclusive,
* url
* }
* credit to https://gist.github.com/mogsdad/6518632
*/
function getAllLinks(element, selectionStartOffset, selectionEndOffsetInclusive) {
var links = []
var type = element.getType()
if (type === DocumentApp.ElementType.TEXT) {
var textObj = element.editAsText()
var text = element.getText()
var inUrl = false
var firstStartOffset = 0
if (selectionStartOffset !== -1) {
firstStartOffset = selectionStartOffset
}
var lastEndOffsetInclusive = text.length
if (selectionEndOffsetInclusive !== -1) {
lastEndOffsetInclusive = selectionEndOffsetInclusive + 1
}
for (var ch = firstStartOffset; ch < lastEndOffsetInclusive; ch++) {
var url = textObj.getLinkUrl(ch)
if (url != null) {
if (!inUrl) {
// We are now!
inUrl = true
var curUrl = {}
curUrl.element = element
curUrl.url = url
curUrl.startOffset = ch
} else {
curUrl.endOffsetInclusive = ch
if (ch === text.length - 1) {
// this hyperlink is the end of the TEXT element
inUrl = false
links.push(curUrl)
curUrl = {}
}
}
} else {
if (inUrl) {
// Not any more, we're not.
inUrl = false
links.push(curUrl) // add to links
curUrl = {}
}
}
}
}
var singletonElement
if (type === DocumentApp.ElementType.INLINE_IMAGE) {
singletonElement = element.asInlineImage()
} else if (type === DocumentApp.ElementType.EQUATION) {
singletonElement = element.asEquation()
} else if (type === DocumentApp.ElementType.EQUATION_FUNCTION) {
singletonElement = element.asEquationFunction()
} else if (type === DocumentApp.ElementType.LIST_ITEM) {
singletonElement = element.asListItem()
} else if (type === DocumentApp.ElementType.PARAGRAPH) {
singletonElement = element.asParagraph()
} else if (type === DocumentApp.ElementType.TABLE) {
singletonElement = element.asTable()
} else if (type === DocumentApp.ElementType.TABLE_CELL) {
singletonElement = element.asTableCell()
} else if (type === DocumentApp.ElementType.TABLE_OF_CONTENTS) {
singletonElement = element.asTableOfContents()
} else if (type === DocumentApp.ElementType.TABLE_ROW) {
singletonElement = element.asTableRow()
} else if (type === DocumentApp.ElementType.TEXT) {
singletonElement = element.asText()
}
if (singletonElement) {
var link = singletonElement.getLinkUrl()
if (link) {
links.push({
element: singletonElement,
url: link,
})
}
}
if (element.getNumChildren) {
var numChildren = element.getNumChildren()
for (var i = 0; i < numChildren; i++) {
links = links.concat(getAllLinks(element.getChild(i), selectionStartOffset, selectionEndOffsetInclusive))
}
}
return links
}
function init() {
var doc = DocumentApp.getActiveDocument()
var selection = doc.getSelection()
if (selection) {
var elements = selection.getRangeElements()
for (var i = 0; i < elements.length; i++) {
var rangeElement = elements[i]
var element = rangeElement.getElement()
if (element.editAsText) {
var text = element.editAsText()
var links = getAllLinks(element, rangeElement.getStartOffset(), rangeElement.getEndOffsetInclusive())
for (var j = 0; j < links.length; j++) {
var link = links[j]
if (link.element.setLinkUrl) {
if (link.hasOwnProperty('startOffset')) {
link.element.setLinkUrl(link.startOffset, link.endOffsetInclusive, '')
} else {
link.element.setLinkUrl(null)
}
}
}
}
}
} else {
DocumentApp.getUi().alert('Select the text with hyperlinks to be removed')
}
}
Method 3: Use Add-on
If you’ve landed here, you’re in luck. There's a free Google Docs add-on called Text Cleaner that can quickly remove all hyperlinks and underlining from your document. It's a more convenient and hassle-free option. The steps are almost identical to Method 2, except you’ll use the menu Text Cleaner > Remove links and underlining.

Conclusion
Hopefully after thoroughly going through this article you have clearly understood all the efficient methods through which you can easily remove all hyperlinks in your Google docs documents. Please follow the discussed methods as is to get the desired results. And feel free to comment below if you face any problem, we will respond as soon as possible to solve your queries. Hope it works for you. Feel free to leave any comments. Thanks for reading.
Related Articles
- How to strikethrough on Google Docs
- Block Version History in Google Docs Editors and Sites
- Disable Voice Typing in Google Docs
- Making of a timeline in Google Docs and Google Sheets
- How to Add an Apps Script to your Google Apps?
For More articles visit our website: xFanatical Articles