Code discovery

Navigate, explore, and understand the code you are looking for, even if you didn’t know it existed.

Find answers faster with Sourcegraph's code navigation and exploration

Powerful, easy search

Just type your query into Sourcegraph, and it'll find matches. It supports regular expressions, punctuation, exact matches, and much more. Use the visual query builder to narrow down your search and get familiar with search syntax for next time.

Super-optimized for speed

Find what you're looking for in a few hundred milliseconds, even across 10,000s of repositories or in a massive 40 GB monorepo. We're maniacal about making Sourcegraph fast. You can also quickly refine your search using suggested filters to narrow down results by repository, language, directory, or custom scopes.

Explore definitions & references, even across projects

Find the definition or callers of functions and anything else in code, even across package, dependency, and repository boundaries. Even if your IDE can do this, Sourcegraph lets you explore code intelligently in your web browser in any repository on any branch, instantly and without losing your local context. Works for 32 programming languages.

Search in diffs to find what changed or broke

Look through diffs and commit messages to see recent changes related to a specific function or error message. DevOps teams and SREs find this especially useful when responding to incidents, to find out what code changes might be responsible and who to loop in.

All branches & commits, always up to date

Other code search tools limit you to searching a single branch and often have stale results from hours ago. With Sourcegraph's hybrid search (combining indexed and on-the-fly), you can search any branch and any commit. The code is always up to date, and you never need to wait for indexing.

Open source, self-managed, & privacy-respectful

Sourcegraph is self-hosted, so your code never leaves your network. And it's open source (Apache 2.0), so you can verify this. (If you prefer not to self-manage your instance, we offer cloud-managed deployment too.)

For our new developers, Sourcegraph has been invaluable to get to know the repository structure, to track down where code lives, and self-service during their investigations.

Owen Kim, Senior Software Engineer, Convoy

See Sourcegraph code discovery in action

Why code search is essential for developers

Google developers use code search 5-10 times daily (see Table 1 in Google's internal code search research study). Sourcegraph Universal Code Search users report similar use cases and frequency.

Find example code
API consumer needs helpI want to know how a function should be called
Discover correct library for taskBest way to convert output stream into a string of limited length
Example to build off ofJust want to copy-and-paste some code I'm changing
How to do somethingHow to write a hash function
Explore or read code
Check implementation detailsWhat does a particular script do?
BrowsingRe-familiarizing myself with some code referenced in a code review
Check best practicesWhere are friend classes usually declared?
Name completionI'm looking for an enum member that begins with a particular prefix
Find specific locations
Trace through call graphWhere is this class instantiated?
SharingI'm trying to create a link to a known piece of code, to give to someone else
Locations in sourceWhere are all the environment configurations declared?
Trace code historyWho last touched this code?
ResponsibilityWho is allowed to approve changes to this file?
Determine impact
Why is something failing?Wondering why my change didn't fix a problem in production and am reading the code to diagnose
Understanding dependenciesLooking for dependencies of a build file
Side effects of a proposed changeAm I about to blow up production with my change?

Software engineering is more about reading code than writing it, and part of this process is finding the code that you should read.

Han-Wen Nienhuys (Google engineer)

Use Sourcegraph to find answers in code, faster!

Sourcegraph integrates with your existing tools and workflow

Code hosting & review
Other services in your workflow
Browser & editor integrations
Programming languages
All programming languages are supported. 32 programming languages have additional code intelligence support.
Download: Universal Code Search and Intelligence
EBOOK

Universal code search and intelligence

How to increase programming productivity and improve code quality
Free download

Try Sourcegraph now

Explore, navigate, and better understand all code, everywhere, faster, with Universal Code Search.