NoCodeComments

Strip comments without breaking code.

A browser-only, syntax-aware comment remover. It protects quoted strings, template literals and regex literals, preserves line endings, and supports dozens of language families.

No file selectedReady

Input

Paste, type, or drop a file

Comment-free output

Test snippets

Copy a snippet into the editor to verify comment removal and string protection.

JavaScript
// API configuration
const url = "https://example.com/api//users";

/* temporary calculation */
const total = 10 + 20;

const message = "Don't remove // this";
console.log(message);
Python
# Configuration
name = "Aaqib"  # user name

url = "https://example.com/api#users"

"""
This is a multiline string.
# This must NOT be removed.
"""

print(name)
Java
// Create the user
public class User {
    /* constructor */
    public User(String name) {
        this.name = name;
    }

    private String name;

    // return the name
    public String getName() {
        return name;
    }
}
TypeScript
// Type-safe configuration
interface User {
    name: string; // display name
}
const user: User = { name: "Aaqib // Khan" };
/* keep this URL intact */
const endpoint = `https://example.com/api/*/users`;
C++
#include <iostream>
// Create a greeting
int main() {
    std::string url = "https://example.com/a//b";
    /* temporary value */
    int total = 42;
    std::cout << total << std::endl;
}
C#
using System;
// Application entry point
class Program {
    static void Main() {
        string url = "https://example.com/api//users";
        /* log-friendly value */
        Console.WriteLine(url);
    }
}
Go
package main

import "fmt" // standard library

func main() {
    // Keep the URL intact.
    url := "https://example.com/a//b"
    /* temporary output */
    fmt.Println(url)
}
Rust
fn main() {
    // Application entry point
    let url = "https://example.com/a//b";
    /* temporary calculation */
    let total = 10 + 20;
    println!("{} {}", url, total);
}
PHP
<?php
// Fetch the user
$url = "https://example.com/api//users";
/* temporary value */
$name = "Aaqib # Khan";
echo $name;
Ruby
# Configuration
url = "https://example.com/api#users"

=begin
This is a block comment.
It should be removed.
=end

puts url
Swift
import Foundation
// Network endpoint
let url = "https://example.com/api//users"
/* temporary configuration */
let name = "Aaqib // Khan"
print(name)
Kotlin
fun main() {
    // Application entry point
    val url = "https://example.com/api//users"
    /* temporary value */
    val name = "Aaqib /* Khan */"
    println(name)
}
SQL
-- Fetch active users
SELECT id, name
FROM users
WHERE status = 'active'; -- only active users

/* temporary filter */
ORDER BY name;
HTML
<!DOCTYPE html>
<!-- Page comment -->
<html>
  <body>
    <h1>Hello <!-- inline comment --> World</h1>
  </body>
</html>
CSS
/* Main container */
.container {
    width: 100%; /* keep the declaration */
    background: url("https://example.com/image//1.png");
}
YAML
# Service configuration
name: nocodecomments
url: "https://example.com/api#users" # public endpoint
ports:
  - 8080
# End of configuration
Dockerfile
FROM node:20
# Install dependencies
WORKDIR /app
COPY package.json .
RUN npm install # production setup
CMD ["node", "server.js"]
Shell
#!/bin/sh
# Deployment script
URL="https://example.com/api#users"
echo "$URL" # print endpoint
# Finished
Lua
-- Configuration
local url = "https://example.com/api//users"

--[[ multiline comment ]]--
local name = "Aaqib -- Khan"
print(name)