# How to delete cookies in JavaScript?

JavascriptWeb DevelopmentFront End Technology

Sometimes you will want to delete a cookie so that subsequent attempts to read the cookie return nothing. To do this, you just need to set the expiry date to a time in the past.

## Example

Try the following example. It illustrates how to delete a cookie by setting its expiry date to one month behind the current date.

<html>
<script>
<!--
var now = new Date();
now.setMonth( now.getMonth() - 1 );

document.cookie = "expires=" + now.toUTCString() + ";"
</html>