Boost.URL is a library for manipulating Uniform Resource Identifiers (URIs) and Locators (URLs).
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
alandefreitas 2bae458a79 fix: member of dll interface class may not be declared with dll interface
fix #748
14 hours ago
.drone Refactor library translation units 2 months ago
.github ci: enable mingw and clang-cl 14 hours ago
antora Refactor library translation units 2 months ago
build Refactor library translation units 2 months ago
cmake Refactor test sources 2 years ago
doc ci: drop gcc 8.0.1 support 14 hours ago
example fix: member of dll interface class may not be declared with dll interface 14 hours ago
extra fix(test): remove test unused variables 14 hours ago
include/boost fix: member of dll interface class may not be declared with dll interface 14 hours ago
meta update test matrix toolsets 8 months ago
src fix: member of dll interface class may not be declared with dll interface 14 hours ago
test build(test): replicate Jamfile error flags 14 hours ago
.codecov.yml Adjust codecov threshold 10 months ago ci: drop gcc 8.0.1 support 14 hours ago
.gitignore Port beast uri 4 years ago
CMakeLists.txt ci: set up cpp-actions matrix 2 days ago
Jamfile update links 9 months ago
LICENSE_1_0.txt Port beast uri 4 years ago README points to boost.url docs 1 month ago
index.html Change doc format from standalone to boostorg 9 months ago


Branch master develop
Docs Documentation Documentation
Drone Build Status Build Status
GitHub Actions CI CI codecov codecov
Matrix Matrix Matrix



Boost.URL is a portable C++ library which provides containers and algorithms which model a "URL", more formally described using the Uniform Resource Identifier (URI) specification (henceforth referred to as rfc3986). A URL is a compact sequence of characters that identifies an abstract or physical resource. For example, this is a valid URL which satisfies the absolute-URI grammar:

This library understands the various grammars related to URLs and provides for validating and parsing of strings, manipulation of URL strings, and algorithms operating on URLs such as normalization and resolution. While the library is general purpose, special care has been taken to ensure that the implementation and data representation are friendly to network programs which need to handle URLs efficiently and securely, including the case where the inputs come from untrusted sources. Interfaces are provided for using error codes instead of exceptions as needed, and all algorithms provide a mechanism for avoiding memory allocations entirely if desired. Another feature of the library is that all container mutations leave the URL in a valid state. Code which uses Boost.URL will be easy to read, flexible, and performant.

Network programs such as those using Boost.Asio or Boost.Beast often encounter the need to process, generate, or modify URLs. This library provides a very much needed modular component for handling these use-cases.


using namespace boost::urls;

// Parse a URL. This allocates no memory. The view
// references the character buffer without taking ownership.
url_view uv( "" );

// Print the query parameters with percent-decoding applied
for( auto v : uv.params() )
    std::cout << v.key << "=" << v.value << " ";

// Prints: id=1001 name=John Doe results=full

// Create a modifiable copy of `uv`, with ownership of the buffer
url u = uv;

// Change some elements in the URL
u.set_scheme( "http" )
 .set_encoded_host( "" )
 .set_encoded_path( "/index.htm" )
 .params().append( {"key", "value"} );

std::cout << u;

// Prints:

Design Goals

The library achieves these goals:

  • Require only C++11
  • Works without exceptions
  • Fast compilation, no templates
  • Strict compliance with rfc3986
  • Allocate memory or use inline storage
  • Optional header-only, without linking to a library


  • Requires Boost and a compiler supporting at least C++11
  • Aliases for standard types use their Boost equivalents
  • Link to a built static or dynamic Boost library, or use header-only (see below)
  • Supports -fno-exceptions, detected automatically


To use as header-only; that is, to eliminate the requirement to link a program to a static or dynamic Boost.URL library, simply place the following line in exactly one new or existing source file in your project.

#include <boost/url/src.hpp>


Boost.URL works great on embedded devices. It can be used in a way that avoids all dynamic memory allocations. Furthermore it is designed to work without exceptions if desired.

Supported Compilers

Boost.URL is tested with the following compilers:

  • clang: 3.8, 4, 5, 6, 7, 8, 9, 10, 11, 12
  • gcc: 4.8, 4.9, 5, 6, 7, 8, 9, 10, 11
  • msvc: 14.0, 14.1, 14.2, 14.3

and these architectures: x86, x64, ARM64, S390x

Quality Assurance

The development infrastructure for the library includes these per-commit analyses:

  • Coverage reports
  • Benchmark performance comparisons
  • Compilation and tests on

Visual Studio Solution Generation

cmake -G "Visual Studio 16 2019" -A Win32 -B bin -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/msvc.cmake
cmake -G "Visual Studio 16 2019" -A x64 -B bin64 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/msvc.cmake


Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at